一道简单的acm题,可是我老是通不过ojInputInputcontains multiple test cases, and one case one line. Each case starts with aninteger N, and then N integers follow in the same line. OutputFor each testcase you should output the sum of N inte
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/21 07:41:20
![一道简单的acm题,可是我老是通不过ojInputInputcontains multiple test cases, and one case one line. Each case starts with aninteger N, and then N integers follow in the same line. OutputFor each testcase you should output the sum of N inte](/uploads/image/z/12636805-13-5.jpg?t=%E4%B8%80%E9%81%93%E7%AE%80%E5%8D%95%E7%9A%84acm%E9%A2%98%2C%E5%8F%AF%E6%98%AF%E6%88%91%E8%80%81%E6%98%AF%E9%80%9A%E4%B8%8D%E8%BF%87ojInputInputcontains+multiple+test+cases%2C+and+one+case+one+line.+Each+case+starts+with+aninteger+N%2C+and+then+N+integers+follow+in+the+same+line.+OutputFor+each+testcase+you+should+output+the+sum+of+N+inte)
一道简单的acm题,可是我老是通不过ojInputInputcontains multiple test cases, and one case one line. Each case starts with aninteger N, and then N integers follow in the same line. OutputFor each testcase you should output the sum of N inte
一道简单的acm题,可是我老是通不过oj
Input
Inputcontains multiple test cases, and one case one line. Each case starts with aninteger N, and then N integers follow in the same line.
Output
For each testcase you should output the sum of N integers in one line, and with one line ofoutput for each line in input.
Sample Input
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
一道简单的acm题,可是我老是通不过ojInputInputcontains multiple test cases, and one case one line. Each case starts with aninteger N, and then N integers follow in the same line. OutputFor each testcase you should output the sum of N inte
#include<stdio.h>
int main()
{
int n,x,sum;
while(scanf("%d",&n)!=EOF)
{
sum = 0;
while(n--)
{
scanf("%d",&x);
sum+=x;
}
printf("%d/n",sum);
}
return 0;
}
学习一下输入输出就好,欢迎交流.