JAVA
您需要编写一个类名为Main(大小写敏感)的public类,类中包含入口main函数,并且不要使用package。请参考附录中的JAVA程序。
| 判测结果 | 缩写 | 含义 |
|---|---|---|
| Waiting | WT | 用户程序正在排队等待测试 |
| Accepted | AC | 用户程序输出正确的结果 |
| Presentation Error | PE | 用户程序输出有中有多余的空行,或者某行内有多余的空格。 |
| Time Limit Exceeded | TLE | 用户程序运行时间超过题目的限制 |
| Memory Limit Exceeded | MLE | 用户程序运行内存超过题目的限制 |
| Wrong Answer | WA | 用户程序输出错误的结果 |
| Runtime Error | RE | 用户程序发生运行时错误 |
| Output Limit Exceeded | OLE | 用户程序输出的结果大大超出正确答案的长度 |
| Compile Error | CE | 用户程序编译错误 |
| System Error | SE | 用户程序不能被评测系统正常运行 |
| Validator Error | VE | 用户程序的输出结果导致评测程序非正常退出 |
| Not Available | NA | 针对编程之美系列比赛,大数据的结果在比赛结束前不公开,会显示NA。 |
Given two integers a and b, calculate their sum a + b.
The input contains several test cases. Each contains a line of two integers, a and b.
For each test case output a+b on a seperate line.
1 2 3 4 5 6
3 7 11
| 语言 | 样例程序 |
|---|---|
| C |
#include <stdio.h>
int main(void) {
int a, b;
while(scanf("%d%d", &a, &b) != EOF) {
printf("%d\n", a + b);
}
return 0;
}
|
| C++ |
#include <iostream>
using namespace std;
int main(void) {
int a, b;
while(cin >> a >> b) {
cout << a + b << endl;
}
return 0;
}
|
| Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while(in.hasNext()) {
int a = in.nextInt();
int b = in.nextInt();
System.out.println(a + b);
}
}
}
|
| C# | using System;
public class AplusB
{
private static void Main()
{
string line;
while((line = Console.ReadLine()) != null)
{
string[] tokens = line.Split(' ');
Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1]));
}
}
} |