有关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 45 1 2 3 4 5Sample Output1015 这是题目,我的代码是:#include #include int main(){ int i,a,b,sum; scanf("%d",&a); sum=0; for(i=0;i
最佳回答
这道题属于多组数据输入的,而你的程序只能接受一组数据。改成这样试试:#include #include int main(){int i,a,b,sum;while(scanf("%d",&a) != EOF){sum=0;for(i=0;i
最新回答共有2条回答
-
2026-04-03 09:35:05苹果手链
回复这道题属于多组数据输入的,而你的程序只能接受一组数据。改成这样试试:#include #include int main(){int i,a,b,sum;while(scanf("%d",&a) != EOF){sum=0;for(i=0;i
热门文章
- 康达学院专转本五年制
- 高考一个考场分ab卷吗
- not only but also用法
- 某物体做自由落体运动,从释放开始计时,则物体在前2s内的平均速度为______m/s,物体下落2m时的速度大小为______m/s.
- 三角函数公式大全表格
- 地理中考必背知识点2022
- 2013-2014学年小学六年级科学上学期期末考试试卷及答案
- 人教版2014-2015学年小学五年级英语第二学期期中教学质量检测试卷及答案
- 【Linux驱动开发】设备树详解(二)设备树语法详解
- 别跟客户扯细节
- 在别的城市买房子能落户吗
- 卖房前要把装修贷还完吗
- 高中政治教学提高教学效果的方法探究
- “互联网+”背景下的初中英语课堂教学改革与创新策略研究
- 2022年终止合同范本
- 租房合同范本范文
- 如何挑选土豆
- 如何挑选土鸡
