← Back to topics
Topic

Z-sudoku

D
Dgleich
Can someone please write the test case 4 for Z-sudoku?
p
picsel
Do you check if every character is used exactly 9 times (no more no less)?
D
Dgleich
yep I use one array till 300 and increase their ascii value in array for one and when I go thrugh whole matrix I check if they occur exactly 9 times
D
Dgleich
Can someone view my code?
http://www.z-trening.com/new/www/html/submit.php?submit=7100046326&subm_code=1
p
picsel
From other thread:
"Now solved. The problem was really silly: if you read it by simple char then 128-255 ascii values coded to the range [-128,-1], so at the sorting of the characters I had a mistake, but other parts of my code was good."

Perhaps that is the problem?
Or check this thread, maybe you find something
http://www.z-trening.com/new/www/html/forum.php?show_board=10002&ref_id=10002&view_topic=110902
D
Dgleich
Yea that's the problem now I have to solve it :D

Thanks, Can you write how can I enter those Unicode Chars?
A
Al3kSaNdaR
I think that you must use unsigned char.
D
Dgleich
Yea but How to read characters ?
I tryed with getchar but no success..
D
Dgleich
Now I got it to work on 4 and 7 but it fails when there is an empty space, can someone tell me how to read whole line with scanf?
m
msantl
i have used
cin.getline(niz[x],256);
D
Dgleich
It's failing on test case 8...:D
D
Dgleich
It's not working with cin.getline, I tryed it with unsigned char and it gives error on compiling but without unsigned char it won't pass test case 4,7:
:D
m
msantl
i didn't use unsigned char, i just checked if the ASCII value smaller than 0 is, and if it is i have added some number (3000) to it, and in the end when i was printing the solution i have checked if the value greater then 1900 is, i printed this value-3000.
D
Dgleich
It worked thanks...