A + B Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 457755 Accepted Submission(s): 145211
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我当初写的代码#include <iostream>
using namespace std;
int main() { int a , b ; cin>>a>>b;
cout<<a+b;
return 0; }
原来它有多组测试数据啊,如果我像上面写的那样只能测试一组就结束了,会错了。应该这样写#include <iostream>
using namespace std;
int main() { int a , b ;
while(cin>>a>>b) {cout<<a+b<<endl; } return 0; }
以后要学的知识还有很多,加油