从今天开始做steps上面的题目了。大体看了一下难度,感觉不是很难,现在都是一些A+B的题目,争取一次过掉。把源码发在这里,再写几句解题心得什么的……
1.1.1A+B for Input-Output Practice (I)
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
Author
lcy
参考代码:
#include int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) printf("%dn",a+b); }
最简单的题目了,没什么好说的,注意while语句后面不要加分号,一开始居然错在这上面了………………
授权协议:创作共用 署名-非商业性使用 2.5 中国大陆
除注明外,本站文章均为原创;转载时请保留上述链接。