您的位置:首页 > 其它

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

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));
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: