HDU1000 A + B Problem【水題】
阿新 • • 發佈:2018-12-14
A + B Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 834475 Accepted Submission(s): 252425
Problem Description
Calculate A + B.
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.
Sample Input
1 1
Sample Output
2
Author
HDOJ
Recommend
問題連結:http://acm.hdu.edu.cn/showproblem.php?pid=1000。
問題簡述:每一行輸入兩個整數a,b,輸出這兩個整數之和。
問題分析:利用while迴圈,實現多組資料輸入。
程式說明:使用了while迴圈體。
AC通過的C++語言程式如下:
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << a + b << endl; } return 0; }