How online judge works!!!!!!.Its becomes the main question for the new comer in comparative programming.when they submit a few problems in the online judge it comes to their mind how judge treat their program.Because of getting wrong answer a few questions comes out from mind like
*is there any problem with the compiler!!!??
*why its showing wrong answer
judge verdict your answer as wrong when your program don’t match the out put ,its a programmer fault if its receive verdict wrong answer.
now comes to the point how judge pc works:
an online judge is a software base environment which judge your code in the judge website like (Uva,codeforces,codechef,codemarshal,light oj).For cheek your code judge use a file which contain input set(called input.text) which are fed to the program’s standard input stream.
The output of program is collected in another file (output.txt). After that the output.txt file is compared with a file which contains the expected output. The result is returned accordingly (correct / incorrect).
There are redirection operators ( > and <) supported by shell of an operating system. (Eg. DOS, Bash etc). For those who don’t know about shell, it is just the command prompt of operating system. We write the following line on the DOS shell to test our code.
nameOfFile.exe < input.txt > output.txt
The above means “Feed the input to file ‘2.Number_Tower.exe’ from file ‘input.txt’ and save the output of program to ‘output.txt’. For a c program , we can write this :
NameOfMyProgram < input.txt > output.txt
The ‘<‘ operator means to read the input from specified file and ‘>’ operator means to redirect the output to the specified file. In this program, we had to just read no.s and print same to the console (which are now written to the file).
After executing, the content of output.txt file are : (no.s on the left side in RED specify line no.s)
While submitting your program to an online judge, please keep this in mind that it is the program and not the person who is judging your program.So don’t write like this
“Please enter a no.”
For more information stay with us…If you face any problem please a comment in the comment box…