Hoping for good response from all coders. PROBLEM: http://mirror.codeforces.com/contest/387/problem/C
My Submitted code: [submission:http://mirror.codeforces.com/contest/387/submission/5861759]
Although, my code is running fine & showing right output to given testcases. But, Codeforces says that this code is giving another output.How could be this possible? It would be great help if someone says, what is the output generated my my code to their PC?
And, I want to codeforces authority to look at to this issue carefully.
Thanks in advance.
In my PC, it said '2'.
Take a look. http://mirror.codeforces.com/contest/387/submission/5861989
UPD. You should never write something like that for a string:
for(int i=0; a[i]; i++)
We can use this code with array of char.
You have multiple errors in your code:
for(int i=0; a[i]; i++)
like vas.and.tor noted, dofor (int i = 0; i < a.size(); i++)
insteadoperator <
will returntrue
if strings are equaloperator <
for strings, are you sure your version is used?if(s[i+1]=='0')
in two placesThanks @Damon , vas.and.tor and andreyv for help.
I would recommend to debug it on Codeforces servers using customtest feature. Make some debug output and try to find out where does it work differently.