A + B Problem 【HDU - 1000】
题目
Calculate A + B.
Time limit | Memory limit | OS | Source |
---|---|---|---|
1000 ms | 32768 kB | Windows | - |
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, output A + B in one line.
Example
Input | Output |
---|---|
1 1 | 2 |
1 5 | 6 |
问题链接: HDU - 1000
问题描述
计算A + B的值,并输入多行数据
问题分析
行吧,问题短,但是不一定能AC
遇到多组输入的情况
代码都差不多是这样写的
将输入作为判断条件
AC通过的CPP代码如下
#include<iostream>
using namespace std;
int main()
{
int a,b;
while (cin >> a>> b)
{
cout << a + b << endl;
}
return 0;
}