1501 待删除A+B
Time Limit : 26000/13000 MS(Java/Others) | Memory Limit : 131070/65535 KB(Java/Others)
Submits : 11 | Solved : 10
Description
Calculate a+b
Input
Two integer a,b (0<=a,b<=10)
Output
Output a+b
Sample Input
1 2
Sample Output
3
HINT
Here is a sample solution using C++/G++:
#include "iostream"
using namespace std;
int main()
{
int a,b;
while( cin >> a >> b )
cout << a+b << endl;
return 0;
}
It's important that the return type of main() must be int when you use G++/GCC,or you may get compile error.
Here is a sample solution using C/GCC:#include
int main()
{
int a,b;
while( scanf("%d %d",&a, &b) != EOF )
printf("%d\n",a+b);
}
Here is a sample solution using PASCAL:
program p1501(Input,Output);
var
a,b:Integer;
begin
Readln(a,b);
Writeln(a+b);
end.
Here is a sample solution using Java:
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws Exception {
Scanner cin = new Scanner(System.in);
while (cin.hasNext()) {
int a = cin.nextInt(), b = cin.nextInt();
System.out.println(a + b);
}
}
}
Source
NBU OJ