• + 1 comment

    withouth trying the code, I notice that you are using "long" vars, the problem mention that some of the number cannot be stored in a long (ie 64 bit type). Probably with a BigInteger can work.