POJ 1503 Integer Inquiry(大数相加,java)
我要开始练习一些java的简单编程了^v^
import java.io.*;
import java.util.*;
import java.math.*; public class Main { /**
* @param args
*/
public static void main(String[] args) throws Exception {
// 定义并打开输入文件
Scanner cin = new Scanner(System.in); BigInteger a, sum, zero; //大数定义
sum = BigInteger.ZERO; //置零
zero = BigInteger.valueOf(0); //置零 while(cin.hasNext()) { //判断是否输入结束
a = cin.nextBigInteger() ; //大数输入
if(a.equals(zero)) { //判断是否等于0
break;
}
sum = sum.add(a); //大数相加
}
System.out.println(sum); //输出结果 cin.close(); //关闭输入文件
} }
POJ 1503 Integer Inquiry(大数相加,java)的更多相关文章
- POJ 1503 Integer Inquiry(大数相加)
一.Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exp ...
- POJ 1503 Integer Inquiry 大数 难度:0
题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util. ...
- hdu acm-1047 Integer Inquiry(大数相加)
Integer Inquiry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Poj 1503 Integer Inquiry
1.链接地址: http://poj.org/problem?id=1503 2.题目: Integer Inquiry Time Limit: 1000MS Memory Limit: 1000 ...
- HDU 1047 Integer Inquiry 大数相加 string解法
本题就是大数相加,题目都不用看了. 只是注意的就是HDU的肯爹输出,好几次presentation error了. 还有个特殊情况,就是会有空数据的输入case. #include <stdio ...
- POJ 1503 Integer Inquiry 简单大数相加
Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his explo ...
- poj 1503 Integer Inquiry (高精度运算)
题目链接:http://poj.org/problem?id=1503 思路分析: 基本的高精度问题,使用字符数组存储然后处理即可. 代码如下: #include <iostream> # ...
- Integer Inquiry(大数相加)
Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his explo ...
- Integer Inquiry 大数加法
Integer Inquiry 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 import java.text.* ...
随机推荐
- 信号驱动的IO
(1)client1,基于SIGIO的写法: #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h ...
- MIFARE系列6《射频卡与读写器的通讯》
1. 复位应答(Answer to request) 读写器呼叫磁场内的卡片,卡片对呼叫做出应答.对刚进入磁场得到电复位处于休闲状态的卡片,卡请求(REQA,0x26):对于已进行过读写操作并进入休眠 ...
- R中统计量的中英文解释
Intercept————截距 formula————公式 Residual standard error残差标准差: 1.319 on 10 degrees of freedom 自由度为10 ...
- AIDL与service
Service:Local service,一个进程中的多线程服务. AIDL:remote service,不同进程间通信. Service启动方法: startService():调用方destr ...
- hdu 2112 HDU Today
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2112 HDU Today Description 经过锦囊相助,海东集团终于度过了危机,从此,HDU的 ...
- MYSQL 一些用法
LOAD DATA LOCAL INFILE 'C:/xampp/htdocs/test/file/sample.csv' INTO TABLE sample1 FIELDS TERMINATED B ...
- 三,samba
转载:http://www.cnblogs.com/phinecos/archive/2009/06/06/1497717.html 一. samba的安装: sudo apt-get insall ...
- iOS 进阶 第十九天(0423)
0427 深复制/浅复制 浅复制:是址引用 深复制:是值拷贝 下面是解释,如下图: 运行时机制runtime 1.表象的就是MPMoviePlayer 2.深层的是 clang -rewrite-ob ...
- mysql 创建一个用户,指定一个数据库
mysql 创建一个用户 hail,密码 hail,指定一个数据库 haildb 给 hail mysql -u root -p password use mysql; insert into use ...
- 读《JavaScript语言精粹》的一些感言
最近看了<JavaScript语言精粹>,并且连着看了两遍,如果非要用言语形容的话,那我只能用4个字来形容:相见恨晚.其中的一些经验经过这么多年的摸索其实也了然,但是作者用这么浅薄的书把有 ...