您的位置:首页 > 其它

[An AC a day]1001_HIT_ACM

2013-12-31 00:28 330 查看


A+B

My Tags  (Edit)
 Source : Unknown
 Time limit : 10 sec Memory limit : 32 M
Submitted : 20899, Accepted : 9893

for each pair of integers A and B ( 0 <= A,B <= 10) , Output the result of A+B on a single line.
Sample Input
1 2
3 4

Sample Output
3
7

Sample Code
#include <stdio.h>
int main(void)
{
int a, b;
while (scanf("%d %d", &a, &b)==2)
printf("%d\n",a+b);
return 0;
}


My solution:

#include<stdio.h>

int main()
{
int a,b;
while(scanf("%d%d",&a,&b) != EOF)
printf("%d\n",a+b);
return 0;
}

这道题很easy啦,就是注意下输入结束的标记是EOF就好了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: