#include <iostream>
using namespace std;
int main()
{
int line;
cin>>line;
int i=0;
//c++中动态数组的分配
int *sum_p = new int[line];
int p =line;
for(;p>0;p--)
{
int sum=0;
int number;
cin>>number;
for(;number>0;number--)
{
int digit;
cin>>digit;
sum+=digit;
}
sum_p[i]=sum;
i++;
}
for(int j=0;j<line;j++)
{
//注意必须对最后一个输出添加判断,否则会出现输出格式错误
if(j == line-1)
cout<<sum_p[j]<<endl;
else
cout<<sum_p[j]<<endl<<endl;
}
delete []sum_p;
return 0;
}
转载于:https://www.cnblogs.com/north_dragon/archive/2010/04/25/1720711.html