/ XMU_ACM / 题库 /

A+B Problem

A+B Problem

Background(背景)

for beginners,特设此题,^_^

Description(描述)

输入两个自然数,输出他们的和

Format(格式)

Input(输入格式)

两个自然数 x 和 y (0 <= x, y <= 32767)(0<=x,y<=32767)

Output(输出格式)

一个数,即 x 和 y 的和

Sample(样例)

Input(输入)

123 500

Output(输出)

623

Limitation(限制)

各个测试点1s,16MiB内存空间。

Hint(提示)

Free Pascal Code

var a,b:longint;
begin
    readln(a,b);
    writeln(a+b);
end.

C Code

#include <stdio.h>
int main(void)
{
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b);
    return 0;
}

C++ Code

#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}

Python Code

a, b = [int(i) for i in raw_input().split()]
print(a + b)

Java Code

import java.io.*;
import java.util.Scanner;

public class Main {

    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a + b);
    }
}

Source

Vijos Original