Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- if input() == "Маша":
- masha = True
- else:
- masha = False
- steps = []
- for i in range(int(input())):
- if masha:
- while n % 3 == 0:
- n = n // 3
- while n % 5 == 0:
- n = n // 5
- n += 7
- else:
- n *= 11
- n -= 8
- steps.append(n)
- masha = not masha
- steps = [str(i) for i in reversed(sorted(steps))]
- res = steps[:2]
- print(" ".join([str(i) for i in res]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement