The River I


#21

Thanks. This helped me get the last secret test case.


#22

Friends, my code:

r_1 = int(input())
r_2 = int(input())
#print(r_1, r_2)
n = 10 ** 4
r_1Next = r_1
r_2Next = r_2
i = 0
while i < n: 
    if r_1 < r_2:
        for j in range(len(str(r_1))):
            r_1Next += int(str(r_1)[j])
        r_1 = r_1Next
        i += 1
    elif r_2 < r_1:
        for j in range(len(str(r_2))):
            r_2Next += int(str(r_2)[j])
        r_2 = r_2Next
        i += 1
    elif r_2 == r_1:
        print(r_1)
        i = n

Why I get only 88%?:frowning:


#23

make that: while r_1 != r_2.
Then delete everything related to i and n and move the print statement out of the loop.