您的位置:首页 > 编程语言 > PHP开发

HDU-1089 A+B for Input-Output Practice (I)

2018-03-10 17:23 471 查看

[align=left]Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
[/align]
[align=left]Problem Description[/align]Your task is to Calculate a + b.
Too easy?! Of course! I specially designed the problem for acm beginners. 
You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim. 
[align=left]Input[/align]The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. 
[align=left]Output[/align]For 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. 
 [align=left]Sample Input[/align]
1 510 20 [align=left]Sample Output[/align]
630
[align=left]Author[/align]lcy


C++代码

#include<iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
{
cout<<a+b<<endl;
}
return 0;
}

  一、测试数据的数量没有限制
  二、测试数据是一对整数
  三、每一行输入对应一行输出,暗示输出两数之和后要换行,保证输出占一行
  四、小白在读题时可能误认为先按输入表列输入最后一次性按下回车输出所有输出表列;正确理解为输入一行输出一         行,输入一行输出一行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: