HDU___1000

来源:互联网 发布:dota2怎么看输出数据 编辑:程序博客网 时间:2024/06/07 08:10

            
                                                              A + B Problem
             
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 658193    Accepted Submission(s): 205141

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
 

Recommend
We have carefully selected several similar problems for you:  1001 1002 1091 1092 1093 

分析:考查对数据输入输出的处理,多组数据用到循环,处理到文件末尾 C语言用scanf()函数返回到的值来判断(无输入返回0),判断其是否等于常量EOF(其值为0),C++用while(cin>>);  C语言的输入输出比C++的耗时少

#include<bits/stdc++.h>using namespace std;int main(){ int a,b; while(~scanf("%d%d",&a,&b)) {  printf("%d\n",a+b); }}
0 0