题目
有关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
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
改成这样试试:
#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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1助人为乐-英文翻译
- 2熔点为0物质
- 3在标准状况下,22.4L稀盐酸配成0.5L盐酸溶液,其物质的量的浓度是多少的解题过程
- 4某商场内底层到2楼间有一个电动扶梯以恒定速度运转,有人用某个不变速率从底层到2楼的过程中数得扶梯有N1级
- 5甲、乙、丙三人共存款22000元,三人用存款各买了一台相同的电视机,甲用了自己钱数的9/16,乙用了自己钱数的1/2,丙用了自己钱数的9/10,三人原来各有存款多少元?
- 6如图是一个长方形. ①在长方形中,画一条线段,把它分成一个最大的等腰直角三角形和一个梯形. ②在这个梯形中最大的角是_度.
- 7边长为a,质量为10m的立方块置于倾角为30o的固定斜面上,半径为a/2,质量为m的圆柱依次搁置成一排,各处均光滑,但物块底面粗糙,其与斜面之间的静摩擦系数为(2*根号2)/3 ,试求保持系统静止时最
- 8设有甲、乙、丙三个桶,甲中装有500克水,乙中装有浓度为40%的盐水750克,丙中装有浓度为50%的盐水500克.首先将甲中水的一半倒入乙,然后将乙中盐水的一半倒入丙,再将丙中盐水的一半
- 9一台电动机的转速是1480转,皮带轮的直径是200毫米,从动轮的转速是2000转,从动
- 10用冥思遐想 不可名状分别造句急啊啊啊啊啊啊啊啊啊啊
热门考点
- 1在实验室里用氢气还原氧化铜制取铜.若制取8g铜,需要氧化铜多少克?同时生成多少克水?
- 2用两种方法数彩笔,每种数发都余2支,这些彩笔至少有多少支?
- 3冰心诗四首诗歌中的形象与主题之间内在的联系,诗歌中主旨与形象的关系并运用其他诗歌来浅谈
- 4什么时候在疑问句中用some不用any
- 5不解……一道数学题(在杂志上看到的)
- 6The weather in Beijing is colder than_____.A.in Heifei B.Heifei C.that in Heifei D..that of Heife
- 7语文高手进!急呀急呀
- 8一块三角形的地的面积是0.4公顷,它的底是100米.那么它的高是多少米?
- 9圆柱和圆锥的半径比是1:2,圆柱是圆锥高的8/9,那么,圆柱和圆锥体积的比是_.
- 10log2^3=m 用m的代数式表示 log 24^18