During the round I got 6 WA for problem A. This is my solution 3804729.
I was using math pow
function for generating a number from it's digits. Simply like this - pow(10, j)
, 0 < j < number of digits.
After the contest I found that each time pow
was returning floor results. So I used for
loop instead of pow
and it worked 3804738.
And most frustrating thing is that first solution is giving correct result for each test case on my PC. Can anyone please tell me why pow
function failed in this case?