题滴链接:https://www.dotcpp.com/oj/problem1000.html
问题 1000: [竞赛入门]简单的a+b
时间限制: 1Sec 内存限制: 128MB 提交: 41250 解决: 19420
题目描述
输入两个整数a和b,计算a+b的和
注意此题是多组测试数据
输入
输入两个整数A和B
范围不超过2^10
输出
求A+B
样例输入
1 1
10 20
样例输出
2
30
鄙人拙见:
- 输入a与b
- 相加
- 注意可多次使用程序(使用hasNext()函数解决)
JAVA参考代码1.0:
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
while(input.hasNext())
{
int a = input.nextInt();
int b = input.nextInt();
System.out.println(a+b);
}
}
}