wizen-coder
9/28/2018 - 12:36 PM

样例输入 4 1 2 3 4 5 1 2 3 4 5 样例输出 10 15

样例输入 4 1 2 3 4 5 1 2 3 4 5 样例输出 10 15

#include<iostream>
using namespace std;
int main()
{
    int n,temp,sum=0;
    while(cin>>n)
    {
      for (int i=0; i<n; ++i){
        cin >> temp;
        sum += temp;
      }
      cout << sum << endl;
      sum = 0;
    }
    return 0;
}