Accepted Sample Codes
AMiR · 2013-11-16 22:37:06
Hi,
As many users try this problem in order to be familiar how judge works, I've decided to write sample codes here:
You should read input file till EOF.
In C++:
#include <iostream>
using namespace std;
int main() {
int a, b;
while(cin>>a>>b)
cout<< a+b <<endl;
return 0;
}
C:
#include <stdio.h>
int main() {
int a, b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
return 0;
}
In JAVA (note that you should have just one public class in your code and it should be named Main)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while (cin.hasNext())
System.out.println(cin.nextInt()+cin.nextInt());
}
}
And finaly FPC:
program main(Input,Output);
var
a,b:Integer;
begin
while not eof(Input) do
begin
Readln(a,b);
Writeln(a+b);
end;
end.
Rubén · 2013-11-20 10:02:40
And in php?
AMiR · 2013-11-20 13:36:33
Rubén said:
And in php?
There is a problem with the new version of Php in the judge server.
We are working on it and will let you know when it is fixed :)
There was a problem with python too, but it has been resolved.
Rubén · 2013-11-20 22:30:08
Thank you very much for your answer!
Rubén · 2013-11-21 07:02:22
When u fix it please tell me how it reads input and output.Thankyou
تربچه · 2014-01-30 18:25:50
and in Python ? .... tanQ ^_^
AMiR · 2014-02-01 09:42:25
Nixon(WaterMelon) said:
and in Python ? .... tanQ ^_^
Here is the python sample code:
python
import sys
for line in sys.stdin:
l = line.split()
print int(l[0]) + int(l[1])
Mohammad Mahdi Zolghadr · 2015-08-20 18:21:53
its not correct and judge! :| in problem said input separeted with space and i think my input is file and my source solve with file input :D
- 1