标题:nankai online judge 1023
取消只看楼主
shenderong
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-5-15
 问题点数:0 回复次数:0 
nankai online judge 1023

http://acm.nankai.edu.cn/p1023.html

对于输入的数据进行求和。

Input
输入有多行数据,每行有若干整数,这些整数数以空格分割,请分别求出每行整数的和。

Output
输出的每行对应输入的每行,每行一个数字,即为输入的一行整数之和。
Sample Input
100 200 4
45 45Sample Output
304
90

我提交的代码:

#include <iostream>
using namespace std;

int main()
{ int sum=0;
char a;
int b;
while(cin>>b,cin.get(a))
{
sum+=b;
if (a =='\n')
{
cout<<sum<<endl;
sum=0;
}
}
return 0;
}
明明对的,为什么一直判我WRONG ANSWER呢?

搜索更多相关主题的帖子: judge nankai online 每行 整数 
2007-07-21 12:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-157038-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.670436 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved