题目描述
计算a + b。a和b是整数。
输入
第一行输入有一个正整数N. 它代表了要遵循的测试案例的数量。然后有N行,每行包含两个整数,a和b。1 <= N <= 1000000。
输出
对于每个测试用例,输出一行,其中包含两个整数a + b的和。
样例输入
3
1 2
10 20
324 111
样例输出
3
三十
435
代码实现:
package cugoj;
/*题目描述
* 计算a + b。a和b是整数。
* 输入
* 第一行输入有一个正整数N. 它代表了要遵循的测试案例的数量。然后有N行,每行包含两个整数,a和b。1 <= N <= 1000000。
* 输出
* 对于每个测试用例,输出一行,其中包含两个整数a + b的和。
* 样例输入
* 3
* 1 2
* 10 20
* 324 111
样例输出
3
30
435*/
import java.util.Scanner;
public class Main4 {
public static void main(String[] args)
{
// TODO Auto-generated method stub
Scanner s1=new Scanner(System.in);
int count =s1.nextInt();
int flag=count;
int []nums=new int[count*2];
while(flag>0)
{
for (int i=0;i<count*2;i++)
{
nums[i]=s1.nextInt();
flag--;
}
}
for (int i=0;i<count;i++)
{
System.out.println(nums[i*2]+nums[(i*2)+1]);
}
s1.close();
}
}