Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def gcd(a, b):
- while a != 0 and b != 0:
- if a > b:
- a %= b
- else:
- b %= a
- return a+b
- a, b, c, d, N, n = [int(i) for i in input().split()]
- l, r = a / b, c / d
- e, f = 1, 1
- arr = []
- num = 0
- while len(arr) < n:
- while e <= N and e / f <= l:
- e += 1
- if e / f >= r:
- e = 1
- f += 1
- while f <= N and e / f >= r:
- f += 1
- if e > N or f > N:
- break
- if l < e / f < r:
- if gcd(e, f) == 1:
- arr.append([e, f])
- if e < N:
- e += 1
- else:
- f += 1
- e = 1
- print(len(arr))
- for i in arr:
- print(i[0], i[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement