Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = list(input())
- y = int(input())
- while len(x) >= 10:
- tmp = int("".join(x[:3]))
- if tmp < y:
- tmp = int("".join(x[:4]))
- tmp -= y
- x[0] = str(tmp // 1000)
- tmp = tmp % 1000
- x[1] = str(tmp // 100)
- tmp = tmp % 100
- x[2] = str(tmp // 10)
- tmp = tmp % 10
- x[3] = str(tmp)
- else:
- tmp -= y
- x[0] = str(tmp // 100)
- tmp = tmp % 100
- x[1] = str(tmp // 10)
- tmp = tmp % 10
- x[2] = str(tmp)
- while x[0] == "0":
- x = x[1:]
- print(int("".join(x)) % y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement