Back to Problem Solutions forum
Help me, pls!
Is there a mistake in example or there is a trick which i don't understand?
///////////////////////////////////////////////////////////////////////
Example:
input data:
4
?942682966937054
1217400151414995
2146133934?67114 <- problem is here
2553514623364925
answer:
3942682966937054 1217040151414995 2146133934667114 2553514623369425
///////////////////////////////////////////////////////////////////////
Problem with 3d line cheksum: 2146133934?67114 <- cheksum is 67
2146133934667114 <- (? = 6) => ( ? = 67 + 6*2 = 79)
79/10 = 7.9 => cheksum is incorect!
6 * 2 gives a 2 digit number so you need to subtract 9
2146133934667114 <- (? = 6) => ( ? = 67 + 6*2-9 = 70)
I was inattentive, my bad. Thanks for your response, i've fixed algorithm and it works now!