Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) |
Total Submission(s): 66365 Accepted Submission(s): 26245 |
Problem Description 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.
|
Input The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. 输入将由一系列由整数a和b组成的对,由一个空格分隔,每行一对整数。 |
Output 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. 对于每对输入整数a和b,您应该在一行中输出a和b的总和,并在输入中输出每行的一行输出。 |
Sample Input 1 5
|
Sample Output 6 |
C++
#include<iostream>
using namespace std;
int main(){
int a,b;
while(cin>>a>>b) //初学者应该掌握这种循环输入方式
cout<<a+b<<endl;
return 0;
}

本文介绍了一个简单的C++程序设计问题:计算两个整数a和b的和。此问题旨在帮助C/C++初学者熟悉基本的输入输出操作及循环处理方式。





