Your task is to Calculate the sum of some integers输入Input contains multiple test cases Each test case contains a integer N and then N integers follow in the same line A test case starting with 0 termi
解题思路: 每组数据都有多个整数,需要将它们相加求和。因为每个数据组都是独立的,所以可以用一个 while 循环来实现多组数据输入,用一个内层循环来对每组数据进行求和。
注意:
- 每组数据的第一个整数表示该组数据中后面要输入的整数个数,需要将其读取并保存到变量 n 中。
- 每组数据输入完毕后需要输出一行空行。
参考代码:
原文地址: http://www.cveoy.top/t/topic/hjHo 著作权归作者所有。请勿转载和采集!