poj-2756-Autumn is a Genius

来源:互联网 发布:英制锥螺纹编程实例 编辑:程序博客网 时间:2024/05/17 23:10

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));              }          }      }  
0 0