Closed dipsankarb closed 9 years ago
Can you provide more details? Like, the expected output file and your output produced by your solution.
Its a simple program to convert from Fahrenheit to Celsius. I have created the input output test cases with only 1 test case for simplicity. I have ran the C code and taken its output to create the test case output file. Still it shows WA. I even wrote a checker for the code so that it outputs OK. Still it outputs WA.
I can send you the files if you want. Please share your email.
Can you just post the relevant parts of the file(s) here? It is more convenient because everything will be centralized here as an issue.
The convert.c file :
int main() { float c,f;
scanf("%f",&c);
f=(9*c/5)+32;
printf("%f\n",f);
return 0;
}
testcase.in :
32
testcase.out :
89.599998
And could you post your checker code?
using namespace std;
ifstream testcase_input, judges_output; bool correct;
int main(int argc, char\ argv) {
// prepare the input for official testcase files
testcase_input.open(argv[1]);
judges_output.open(argv[2]);
// read contestant's output for this test case
// .....
double c,d;
testcase_input>>c;
judges_output>>d;
// checker's logic starts here
// .....
if(c == d)
correct=1;
else
correct=0;
// If correct, print [OK], otherwise [NOT OK]
if (correct) cout << OK << endl;
else cout << NOT_OK << endl;
return 0;
}
Well you can't do exact comparison for floating points. You have to use some epsilon.
Try changing
if(c == d)
to, like
if(abs(c - d) < 1e-3)
if you want to accept up to 3 correct digits.
Did that.
When I check it on my terminal using the same files and the code output. The checker outputs OK.
But when I upload the checker to the portal. It still gives WA.
Hi,
Any luck with the issue ? I am actually using the system for an evaluation and need to put up the problem soon.
Please let me know.
Quick check: Are you absolutely sure you can compile the checker code on your server?
Worst-case scenario suggestion: just use exact comparison. Specify the number of digits that must be printed after the decimal points in the problem statement.
The checker code compiles and works fine. No issues with that. After a lot of trials I figured that the system will work only on floating point numbers where the precision is fixed i.e; the printf has a "%x.xf" type formatting.
Thanks for the help.
i have the same problem, but it's not about floating,it's just simple series of int
input : 5 1 2
output : 1 2 3 5 8
My source code : http://pastebin.com/jC0YbRmF
the output has new line at the end, and the output that was uploaded is actually the output that i get from the source code, so i think the error is about the output comparing in the server,i use testcase only,so i don't use any checker. the problem that was created before this one is just fine, but the problem that i created after this one is having the same error, anyone can help me with my problem ?
First make sure that there are no extra spaces in the output test case files or the code does not print an extra space after the very last integer.
Do the following.
Hope it helps. On May 4, 2015 3:33 AM, "Thosan Girisona" notifications@github.com wrote:
i have the same problem, but it's not about floating,it's just simple series of int
input : 5 1 2
output : 1 2 3 5 8
My source code : http://pastebin.com/jC0YbRmF
the output has new line at the end, and the output that was uploaded is actually the output that i get from the source code, so i think the error is about the output comparing in the server,i use testcase only,so i don't use any checker. the problem that was created before one this is just fine, but the problem that i created after this one is having the same error, anyone can help me with my problem ?
— Reply to this email directly or view it on GitHub https://github.com/fushar/regrader/issues/49#issuecomment-98610035.
Thanks a lot @dipsankarb, it works!, but i still got a question, when i diff the the testcase that i got from the output of the program , and the output of the program itself, the diff said it's different, do you know why?
Agan it is due to the unequal number of white spaces ... To ensure just do a diif -w -q on the two files. If they are not different you will know that a diff -q gives different because of white spaces only.
On Wed, 6 May 2015 at 08:31 Thosan Girisona notifications@github.com wrote:
Thanks a lot @dipsankarb https://github.com/dipsankarb, it works!, but i still got a question, when i diff the the testcase that i got from the output of the program , and the output of the program itself, the diff said it's different, do you know why?
— Reply to this email directly or view it on GitHub https://github.com/fushar/regrader/issues/49#issuecomment-99431477.
Hi,
I am trying to use regrader for a simple problem involving outputs using floating points. I know how to setup the test case files as I have got correct output in other problems. However, in this case I keep on getting WA. I can provide you with the files if needed. Its a bit urgent.
Thanks