首页 > 其他 > 详细

ACM HDU 1000

时间:2017-09-20 22:38:48      阅读:282      评论:0      收藏:0      [点我收藏+]

A + B Problem

 

Problem Description
Calculate A + B.
 
Input
Each line will contain two integers A and B. Process to end of file.
 
Output
For each case, output A + B in one line.
 
Sample Input
1 1
 
Sample Output
2
 
Author
HDOJ
 
 
解题思路:非常简单的一道水题,输入两个整数,输出整数的和。
代码如下 (C语言)
#include <stdio.h>
int main(void)
{
    int a, b;
    int sum,ch;
    while ((ch = scanf_s("%d %d", &a, &b)) == 2)
    {
        sum = a + b;
        printf("%d\n", sum);
    }
    
    return 0;
}
本来以为需要EOF判断结束的,没想到这样成功了。还是不明白AC的机制。

ACM HDU 1000

原文:http://www.cnblogs.com/WLHBlog/p/7565247.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!