一道ACM的入门题:A+B for Input-Output Practice1(入门)DescriptionYour
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/19 23:02:26
一道ACM的入门题
:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases.Each test case contains a pair of integers a and b,one pair of integers per line.A test case containing 0 0 terminates the input and this test case is not to be processed.OutputFor each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.Sample Input1 5
10 20
0 0Sample Output6
30我的答案是:#include
int main()
{
int a,b,s;
while(scanf("%d%d",&a,&b)!=EOF)
if((a!=0)&&(b!=0))
{
s=a+b;
printf("%d\n",s);
}
else printf("");
return 0;
}但提交后是“WRONG ANWSER"请高手指点错在哪了,该怎么改
:A+B for Input-Output Practice1(入门)DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases.Each test case contains a pair of integers a and b,one pair of integers per line.A test case containing 0 0 terminates the input and this test case is not to be processed.OutputFor each pair of input integers a and b you should output the sum of a and b in one line,and with one line of output for each line in input.Sample Input1 5
10 20
0 0Sample Output6
30我的答案是:#include
int main()
{
int a,b,s;
while(scanf("%d%d",&a,&b)!=EOF)
if((a!=0)&&(b!=0))
{
s=a+b;
printf("%d\n",s);
}
else printf("");
return 0;
}但提交后是“WRONG ANWSER"请高手指点错在哪了,该怎么改
题目说的是,同时输入0的时候结束呀!而你的不是呀!
再问: 该怎么改呢?
再答: #include int main() { int a,b,s; while(scanf("%d%d",&a,&b)!=EOF&&(a||b) printf("%d\n",a+b); return 0;
再问: 该怎么改呢?
再答: #include int main() { int a,b,s; while(scanf("%d%d",&a,&b)!=EOF&&(a||b) printf("%d\n",a+b); return 0;
一道ACM的入门题:A+B for Input-Output Practice1(入门)DescriptionYour
杭电的acm的题A+B for Input-Output Practice (IV)
A+B for Input-Output Practice 这是ACM杭大题库的一道题各位大哥大姐们谁知道答案啊?
ACM 第一题,入门级别的a+b
c程序acm题目A+B for Input-Output Practice (VII) Time Limit : 200
一道C语言题:A+B for Input-Output Practice (III)
Matlab一道入门题
A+B for Input-Output Practice (VIII) 为什么 我在 杭电 上 做是 Presenta
一道英语入门题Mike ( ) sports.He ( )watches.A.likes;likes.B.likes d
有没有关于acm入门的书籍 除了刘汝佳的算法竞赛入门经典
一道多边形的内角和简单入门题.急
一道简单的matlab入门题 求大侠指导