题目:http://acm.hdu.edu.cn/showproblem.php?pid=1094
参考题解:
#include<stdio.h>
int main()
{
int m, x;
while (scanf("%d", &m)!=EOF)//不能替换为while (scanf("%d", &m)),否则会报“超时”
{
int sum = 0;//初始化
while (m--)
{
scanf("%d", &x);
sum += x;
}
printf("%d\n", sum);
}
return 0;
}