题目描述
这是一道 $OJ$ 测试题
给定两个整数 $A,B$,输出它们的和 $S$
$$ S = A + B $$
输入格式
一行,两个整数,表示 $A,B$
输出格式
一行,一个整数,表示 $S$
样例数据
input
20 30
output
50
数据规模与约定
$-10^9 \leq a,b \leq 10^9$。
时间限制:$1 \text {s}$
空间限制:$256 \text {MB}$
注意!
$vhosc$学姐提示, $JZPECOJ$ 使用文件输入/输出系统,且只允许一次重定向
Tip:以 “时间限制:1s 空间限制:256MB 输入文件:input.in 输出文件:output.out”中的输入、输出文件为准。
示例代码:
$C++$
// a + b problem in C++
#include <iostream>
using namespace std;
#include<cstdio>
int main()
{
freopen("input.in", "r", stdin);
freopen("output.out", "w", stdout);
int a = 0, b = 0;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
$C++11$
// a + b problem in C++11
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.in", "r", stdin);
freopen("output.out", "w", stdout);
int a = 0, b = 0;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
$C$
/* a + b problem in C */
#include <stdio.h>
int main()
{
freopen("input.in", "r", stdin);
freopen("output.out", "w", stdout);
int a = 0, b = 0;
scanf("%d %d", &a, &b);
printf("%d\n" ,a + b);
return 0;
}
$Pascal$
{a + b problem in Pascal}
var a,b:qword;
begin
assign(input, 'input.in');
assign(output, 'output.out');
reset(input);
rewrite(output);
read(a, b);
write(a + b);
end.
$python3$
# a + b problem in Python
it = open('input.in', 'r+')
ot = open('output.out', 'w+')
# Separate input variables
def xs():
if not hasattr(xs, 'c'):
xs.c = it.read().split()
if not hasattr(xs, 'x'):
xs.x = -1
xs.x += 1
r = xs.c[xs.x]
return r
# Solve it !
a, b = int(xs()), int(xs())
print(a + b, file = ot)