A+b for Input-output Practice (IV)
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 90793 Accepted Submission (s): 48215
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 INPUT4 1 2 3 1 2 3 4 Sample Output1015
1#include <iostream>2 using namespacestd;3 intMain () {4 intN;5 while(CIN >> n && N! =0)6 {7 intsum =0;8 inttemp;9 for(inti =1; I <= N; i++)Ten { OneCIN >>temp; ASum + =temp; - } -cout << sum <<Endl; the } - return 0; -}
View Code
HDU 1092 A+b for Input-output Practice (IV)