Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def gcd(a, b):
- while b:
- a, b = b, a % b
- return a
- a=int(input())
- b=int(input())
- x=int(input())
- seja=0
- sejb=0
- if x%gcd(a,b)!=0 or (x>a and x>b):
- print("Impossible")
- else:
- while x!=sejb and x!=seja:
- if sejb==0:
- print(">B")
- sejb=b
- if x==sejb or x==seja:
- break
- if seja==a:
- print("A>")
- seja=0
- if x==sejb or x==seja:
- break
- print("B>A")
- if seja+sejb>=a:
- (seja, sejb )=(a, sejb-(a-seja))
- else:
- (seja, sejb)=(seja+sejb, 0)
Advertisement
Add Comment
Please, Sign In to add comment