just remove the line where you have checked the value of p and AC
the idea is that when you get the value lesser, in the position nearer to the units place it will lead to better solution than that in the higher digits !
Mate, you are complicating your life a lot by using that vector V. Simply check for digit remainder 3 during a loop, check if sum%3 == d%3. It will give same reaults.
Refer to my implementation and feep free to ask anythibg…
A must know thing for python coders. When dealing with large number, Even basic arithmetic operations like remainder cost time proportional to number of digits, making your solution O(N^2).
Your scanner gives element not found exception by scanner because it cannot find any integer in input file. All number this large will be treated as string input by scanner
Well, i certainly can’t find any test cases. First thing, keep your code clean, it will help degugging. Second thing, you haven’t added last digit to sum after testing for impossible cases.
by doing these it again show RE(NZEC)
and i doesn’t understand
Your scanner gives element not found exception by scanner because it cannot find any integer in input file. All number this large will be treated as string input by scanner