杭电ACM 1094 (A+B for Input-Output Practice (VI))

 杭电ACM 1094 (A+B for Input-Output Practice (VI))_第1张图片

杭电ACM 1094 (A+B for Input-Output Practice (VI))_第2张图片

#include<iostream>
using namespace std;
int main()
{
    int n,sum;
    while(cin>>n)
    {
        sum=0;
        int *num=new int[n];
        for(int i=0;i<n;i++)
        {
            cin>>num[i];
        }
        for(i=0;i<n;i++)
        {
            sum+=num[i];
        }
        cout<<sum<<"\n";
    }
    return 0;
}


 

 

你可能感兴趣的:(ini)