前言
问:说说你印象最深刻的程序
A答:Hello World
B答:A+B
A+B for Input-Output Practice (I)
注:后续的A+B将只有原题链接,没有题目详情哈。建议和我一样的acm小白点击下题目链接,AC
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.
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.
Sample Input
1 5
10 20
Sample Output
6
30
sanwa:我感觉吧,这道题目我还是会做的,像我这么菜的都会的题,肯定没什么说的啦。可能需要注意的点就是输入的样例数是没有限制的,注意输入结束条件即可。我贴下代码,大佬看看有没有什么错或者改进的地方^_^
#include <iostream>
using namespace std;
int main(){
long a,b;
while(cin>>a>>b){
cout<<a+b<<endl;
}
return 0;
}
A+B for Input-Output Practice (II)
INPUT
Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.
sanwa:这道题目和前边不一样的地方在于,确定了输入的数据数量,另外注意的是两道题目的A和B都是integer。大佬看看有没有什么错或者改进的地方^_^
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
while(n--){
long a,b;
cin<