当前位置: > 有关ACM算法的一道题,请各位大牛帮帮忙!...
题目
有关ACM算法的一道题,请各位大牛帮帮忙!
Problem - A+B for Input-Output
DescriptionYour task is to calculate the sum of some integers.InputInput contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.
OutputFor each test case you should output the sum of N integers in one line, and with one line of output for each line in input.
Sample Input4 1 2 3 4
5 1 2 3 4 5Sample Output10
15
这是题目,我的代码是:
#include
#include
int main()
{
int i,a,b,sum;
scanf("%d",&a);
sum=0;
for(i=0;i

提问时间:2021-04-09

答案
这道题属于多组数据输入的,而你的程序只能接受一组数据.
改成这样试试:
#include
#include
int main()
{
int i,a,b,sum;
while(scanf("%d",&a) != EOF){
sum=0;
for(i=0;i
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.