1066 -- A+B(3)

来源:互联网 发布:施乐s2110设置网络打印 编辑:程序博客网 时间:2024/06/10 07:38

A+B(3)

Time Limit:1000MS  Memory Limit:65536K
Total Submit:528 Accepted:283

Description

Your task is to Calculate the sum of some integers.

Input

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 terminates the input and this test case is not to be processed.

Output

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

Sample Input

4 1 2 3 45 1 2 3 4 50 

Sample Output

1015

Source

    using System;    using System.Collections.Generic;    using System.Linq;    using System.Text;    namespace AK1066 {        /// <summary>        /// 表示这条道题我很郁闷,又是一直RE        /// what's a fuck        /// </summary>        class Program {            static void Main(string[] args) {                string sb;                while ((sb = Console.ReadLine()) != null) {                    string[] s = sb.Split();                    int n = int.Parse(s[0]);                    if (n == 0) break;                    int sum = 0;                    for (int i = 1; i <= n; i++)                        sum += int.Parse(s[i]);                    Console.WriteLine(sum);                }            }        }    }


0 0