题目1000:计算a+b 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:28096 解决:12563 题目描述: 求整数a,b的和。 输入: 测试案例有多行,每行为a,b的值。 输出: 输出多行,对应a+b的结果。 样例输入: 1 2 4 5 6 9 样例输出: 3 9 15 直接上代码import java.util.Scanner; public class a_plus_b_java7 { public static void main(String arg[]){ Scanner sc = new Scanner(System.in); int count = 1; Integer a = 0 ; while(sc.hasNext()){ if(count % 2 == 0){ System.out.println(a+sc.nextInt()); } else{ a = sc.nextInt(); } count ++; } } }