|
|
|
|
背景 Background |
|
|
为了for beginngers,特设此题,^_^
|
|
|
|
|
|
|
|
描述 Description |
|
|
输入两个自然数,输出他们的和
|
|
|
|
|
|
|
|
输入格式 Input Format |
|
|
两个自然数x和y(0<=x,y<=32767)
|
|
|
|
|
|
|
|
输出格式 Output Format |
|
|
一个数,即x和y的和
|
|
|
|
|
|
|
|
时间限制 Time Limitation |
|
|
各个测试点1s
|
|
|
|
|
|
|
|
注释 Hint |
|
|
b]Free Pascal Code:
-------------------
var a,b:longint;
begin
assign(input,'p1000.in');
assign(output,'p1000.out');
reset(input);
rewrite(output);
readln(a,b);
writeln(a+b);
close(input);
close(output);
end.
C++ Code:
-------------------
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
freopen("p1000.in","r",stdin);
freopen("p1000.out","w",stdout);
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
fclose(stdin);
fclose(stdout);
return 0;
}
或者:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
ifstream cin;
ofstream cout;
cin.open("p1000.in");
cout.open("p1000.out");
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
cin.close();
cout.close();
return 0;
}
C Code:
-------------------
#include<stdio.h>
#include<stdlib.h>
int main(){
int a,b,c;
FILE *fin = fopen("P1000.in","r");
FILE *fout = fopen("P1000.out","w+");
fscanf(fin,"%d%d",&a,&b);
c=a+b;
fprintf(fout,"%d",c);
close(fin);
close(fout);
return 0;
} |
|
|
|
|
|
|
|
|
Flag |
|
题号 |
P1000 |
|
其它 |
通过 |
385人 |
提交 |
3253次 |
通过率 |
12% |
难度 |
0 |
|
|
|
|
|
|