Official
A - Many A+B Problems Editorial by en_translator
In order to solve this problem, you need to implement just as instructed in the problem statement. Specifically, write a program that perform the following process:
- first, receive an integer \(N\) from Standard Input.
- Next, repeat the following procedure for each \(i = 1, 2, \ldots, N\):
- Receive integers \(A_i\) and \(B_i\) from Standard Input.
- Print \(A_i + B_i\) to the standard output.
It depends on the programming language you use how to interact with Standard Input/Output. Also, one can “repeat a procedure for each \(i = 1, 2, \ldots, N\)” with the loop feature (like for statement) which is a standard feature in a programming language.
The following is a sample code in C++:
#include <iostream>
using namespace std;
int main(void){
int n, a, b;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a >> b;
cout << a + b << endl;
}
return 0;
}
posted:
last update: