HDU 1092 A+b for Input-output Practice (IV)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.