poj-2756-Autumn is a Genius
2016-05-03 22:47
357 查看
Description
Jiajia and Wind have a very cute daughter called Autumn. She is so clever that she can do integer additions when she was just 2 years old! Since a lot of people suspect that Autumn may make mistakes, please write a program to prove that Autumn is a real genius.
Input
The first line contains a single integer T, the number of test cases. The following lines contain 2 integers A, B(A, B < 32768) each. The size of input will not exceed 50K.
Output
The output should contain T lines, each with a single integer, representing the corresponding sum.
Sample Input
1
1 2
Sample Output
3
Hint
There may be ‘+’ before the non-negative number!
大数相加,直接java
Jiajia and Wind have a very cute daughter called Autumn. She is so clever that she can do integer additions when she was just 2 years old! Since a lot of people suspect that Autumn may make mistakes, please write a program to prove that Autumn is a real genius.
Input
The first line contains a single integer T, the number of test cases. The following lines contain 2 integers A, B(A, B < 32768) each. The size of input will not exceed 50K.
Output
The output should contain T lines, each with a single integer, representing the corresponding sum.
Sample Input
1
1 2
Sample Output
3
Hint
There may be ‘+’ before the non-negative number!
大数相加,直接java
import java.util.Scanner; import java.math.BigDecimal; public class Main{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); for(int i=1;i<=n;i++){ BigDecimal a=in.nextBigDecimal(); BigDecimal b=in.nextBigDecimal(); System.out.println(a.add(b)); } } }
相关文章推荐
- hdu-5349-MZL's simple problem
- django实现用户注册、登录、退出
- leetcode-69. Sqrt(x)
- Hadoop 2.x 伪分布式环境部署
- Bitmap和Drawable详解
- 85_线程导致的内存泄漏
- 华为面试题
- 在eclipse中运行Mapreduce & spark
- 关于“万物皆数”的一些观点
- 9. Palindrome Number [easy] (Python)
- fzoj Problem 2233 ~APTX4869 【并查集】
- iOS 开发中的消息机制-代理、通知、block
- 线程生命周期
- 使用PyMySQL操作mysql数据库
- appium 模拟器和真机测试注意事项
- hdoj-2037-今年暑假不AC
- KVO
- Prim算法的实现及应用( 最小生成树)
- 《你好哇,程序员》—教你如何成为一名牛X的程序员
- openwrt UCI API lua wiki