/** * A+B for Input-Output Practice (IV) * 和Problem1000是同一个题目,注意题目要求的输入格式. * Created by YangYuan on 2017/12/7. */ public class Problem1092 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int n = scanner.nextInt(); if (n == 0) break; int sum = 0; for (int i = 0; i < n; i++) sum += scanner.nextInt(); System.out.println(sum); } } }
HDOJ 1092 A+B for Input-Output Practice (IV)
最新推荐文章于 2024-04-16 10:08:09 发布
本文介绍了一个简单的编程练习题“A+B for Input-Output Practice (IV)”,该题要求读取一系列整数并计算每组整数的总和。通过Java实现,使用Scanner类从标准输入读取数据,直到读取到0为止。此题旨在帮助初学者掌握基本的输入输出操作。
415

被折叠的 条评论
为什么被折叠?



