计算 $a + b$ 。
输入多组数据。
每组数据一行,包含2个整数 $a$, $b$(保证 $a$, $b$, $a + b$ 在 $int$ 范围内)。
对于每组数据,输出一行,$a + b$ 的值。
1 2
1 3
3
4
c++ : g++ main.cpp -O2 -std=c++14 -DONLINE_JUDGE -o main
c : gcc main.c -lm -O2 -std=c99 -DONLINE_JUDGE -o main
java : javac Main.java
只对A+B demo示例
#include <stdio.h>
int main()
{
int a, b;
while(scanf("%d%d", &a, &b) != EOF)//注意while处理多个case
{
printf("%d\n", a+b);
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
while(cin >> a >> b)//注意while处理多个case
{
cout << a+b << endl;
}
return 0;
}
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
while(cin.hasNext()) {
int a = cin.nextInt(), b = cin.nextInt();
System.out.println(a + b);
}
}
}
"Accepted" : "AC"
"Wrong Answer" : "WA"
"Compiler Error" : "CE"
"Runtime Error (SIGSEGV)" : "REG"
"Runtime Error (SIGKILL)" : "MLE"
"Runtime Error (SIGFPE)" : "REP"
"Presentation Error" : "PE"
"Memory Limit Exceed" : "MLE"
"Time Limit Exceed" : "TLE"
"Input File Not Ready" : "IFNR"
"Output File Not Ready" : "OFNR"
"Error File Not Ready" : "EFNR"
"Other Error" : "OE"