杭电 A+B for Input-Output Practice (VIII) 谁帮我看看错在哪了?
#include<stdio.h>intmain(){intn,i,m,a,sum;while(scanf("%d",&n)!=EOF){for(i=0;i<=n;i++...
#include <stdio.h>
int main()
{
int n, i, m, a, sum;
while (scanf("%d", &n) != EOF ){
for (i=0; i<=n; i++){
sum=0;
while (scanf("%d", &m) == 1 && (m != 0)){
while (m-- != 0){
scanf("%d", &a);
sum+=a;
}
if (m != 0){
printf("%d\n\n", sum);
}
else
printf("%d\n", sum);
}
}
return 0;
}
} 展开
int main()
{
int n, i, m, a, sum;
while (scanf("%d", &n) != EOF ){
for (i=0; i<=n; i++){
sum=0;
while (scanf("%d", &m) == 1 && (m != 0)){
while (m-- != 0){
scanf("%d", &a);
sum+=a;
}
if (m != 0){
printf("%d\n\n", sum);
}
else
printf("%d\n", sum);
}
}
return 0;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询