A+b for Input-output Practice (IV)Time
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 74414 Accepted Submission (s): 39738
Problem Descriptionyour task is to Calculate the sum of some integers.
Inputinput contains multiple test cases. Each test case is contains a integer n, and then n integers follow on the same line. A test case, starting with 0 terminates, the input and this test are not processed.
Outputfor each group of the input integers you should output their sum on one line, and with one line of output for each line In input.
Sample Input
Sample Output
1015
Program (already accepted):
#include <stdio.h>int main () { int n, number, sum; while (scanf ("%d", &n), N) { sum = 0; while (n--) { scanf ("%d", &number); sum + = number; } printf ("%d\n", sum); } return 0;}
Execution Time:
HDOJ Brush Questions (1092)