the ans can have upto 1000 digits…you can not store it using an int and also the NZEC is due to number format exception!!!
@d27v then you must be missing some corner cases.
Have you checked the points @prad_adm has posted above.
@xnon Your code doesn’t produce any output for all zeroes.
Try 00000 or 0000000000 (any string of 0’s), there is no output.
long double can store huge numbers…but sometimes the precision may be lost!!!
@kunal361 So long double is capable enough to store numbers of range 10^1000. This is “woww”. So in cases where precision is not of that importance we can use long doubles. Right ??
see this…SIZSbF - Online C++ Compiler & Debugging Tool - Ideone.com
also for a functional code using double for a problem in the long contest u can have a look at this code…CodeChef: Practical coding for everyone …this is 1 of my friends code he used 2D matrix of double to store the pascals triangle…!!!
interestingly it stored all values with adequate precision…!!!
@kunal361 is that link SIZSbF - Online C++ Compiler & Debugging Tool - Ideone.com broken, nothing is displayed. Maybe it’s due to user’s privacy control.
oops sorry…changed it!!!
you dont print nething when ans in “0”…pls check that case…!!!
@viaan i m also getting wrong answer…even my solution gives 0 for a string consist of all zero’s
plz check my solution CodeChef: Practical coding for everyone
yes…9000 is correct!!!
thanks… I did change the code to print “0” …
Strange thing i noticed for my program it is giving no output if i have to print single zero. : R0mFoG - Online C++ Compiler & Debugging Tool - Ideone.com
Also for this simple code to no out put: zTR0YP - Online C Compiler & Debugging Tool - Ideone.com
Please help
print a “\n” after 0…i think it will solve the issue!!!
I have the same output for the string. Make sure your output is zero when there is no input- that thing got me stuck the whole time!
thanks … it solved the issue… but still getting WA !!