← Back to topics
Topic

z-sudoku

n
nemanja
I have 0 point on z-sudoku because I thought that at the end of line I will have 2 characters to read, when I remove 1 getchar() form my code I have 8 test cases correct. I think I saw on forum that admin sad that grader shoud award points for both solutions.
T
Tavo92
Did you read the input correctly? Using scanf or cin.get() you are reading the endline too, so you have to handle it.

I read the input like this:

uchar basu;



fors(i, 9)

{

fors(j, 9)

scanf("%c", &mapa[i][j]);

scanf("%c", &basu);

}
n
nemanja
I use getchar() for reading input. First I tried to submit my code with just one getchar() to read \n at the end of line, but grader did not accept my solution(it returned wrong result) so I added one more getchar() expecting that server has \r\n at the end of the line. This solution was accepted by the grader. After competition ended I sent my code with one getchar() and it passed 8 test cases. On one post I also read that admin sad that grader shoud give points to both solutions(I can't find that post, I think it's deleted). I have 0 points on this problem. Can somebody tell me is there some problem with my code or is there problem with grader?