my solution: http://www.codechef.com/viewsolution/2195528
is producing WA always…
and i don’t understand what this statement actually mean(given at the end of problem):
"Different operating systems have different ways of representing a newline; do not assume one particular way will be used. "
m also getting a WA…cant get the bug…
see [this][1] solution…i just got AC for this 1…!!!
i changed the while loop from neglecting spaces at end to find chars in range 0 to 9…and it got AC…i think this is what the last statement meant…the final char can be a char other than ‘\n’ indicating end of line…hope this will help…
that is i changed this part:-
while(ch[pos]==' ')
pos--;
to this:-
while(!(ch[pos]>='0'&&ch[pos]<='9'))
pos--;
where pos is initialized to strlen(ch)-1
[1]: http://www.codechef.com/viewsolution/2195858
2 Likes