- 1
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.
And in php?
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.
Thank you very much for your answer!
When u fix it please tell me how it reads input and output.Thankyou
and in Python ? .... tanQ ^_^
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])
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
In order to post something you must login first. You can use the form in the top of this page.