this weird thing happened with me during a recent DIV 2 contest Codeforces Round #308 (Div. 2) . i submitted this code http://ideone.com/Jdt8it for problem http://codeforces.net/contest/552/problem/B and as u can see for input 99 i am getting the out 189 but here is my codeforces submission #11648222 and here it shows that for test case #4 which is actually input=99 my code is giving output 190. i tried running this same code on codechef IDE and there also with input 99 i got 189. so, can someone please help me why this weird thing might be happening!!!!
For add up : Attached screenshots of his solution output on CodeForce, Ideone and Codechef IDE.
thanks skbly7!!! :)
POW -_-
also your code for test = 100 gives 192 on my computer whereas I've got WA with your code on this test! (it have outputted 193!)
anyway, casting the function "pow" to "long long int" is not a good choice, instead, you can pre calculate the powers of ten before the main part of your code, here I've changed your code a bit and it've got accepted.
it is because pow function does not work well on it. look at this. : http://ideone.com/ypEdeI I submitted it and it worked