1 #include <stdio.h> 2 int main() 3 { 4 int T,n; 5 int a,sum=0; 6 while(scanf("%d",&T)!=EOF){ 7 while(scanf("%d",&n)!=EOF){ 8 int i; 9 for(i=0;i<n;i++){ 10 scanf("%d",&a); 11 sum+=a; 12 } 13 printf("%d ",sum); 14 sum=0; 15 } 16 } 17 return 0; 18 }
1 #include <stdio.h> 2 int main() 3 { 4 int T,n; 5 int a,sum=0; 6 while(scanf("%d",&T)!=EOF){ 7 while(scanf("%d",&n)!=EOF){ 8 int i; 9 for(i=0;i<n;i++){ 10 scanf("%d",&a); 11 sum+=a; 12 } 13 printf("%d ",sum); 14 sum=0; 15 } 16 } 17 return 0; 18 }