Why this problem is difficult


#1

They have a test case where A=9247, so you cannot actually compute the complete factorial up front. You need to factor out the 10s (where 10=2*5) as you go, to prevent overflow.