Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x1, x2 = map(int, input().split())
- y1, y2 = map(int, input().split())
- a = y1 * x2
- d = a
- b = y2 * x1
- c = b
- while c != 0:
- d %= c
- d, c = c, d
- x = abs(b // d)
- y = abs((y1 * x2) // d)
- if x1 < 0 and x2 > 0 or x1 > 0 and x2 < 0:
- x = -1 * x
- if y1 < 0 and y2 > 0 or y1 > 0 and y2 < 0:
- y = -1 * y
- print(x, y)
- N, M = map(int, input().split())
- e = int('1' * N, 2)
- a = int(input(), 2)
- c = int('1' + '0' * (N - 1), 2)
- b = 0
- for i in range(0, M):
- f, g = map(int, input().split())
- if f == 1:
- if (g + b) % N != 0:
- z = c >> ((g + b) % N - 1)
- else:
- z = c >> (g + b - 1)
- a = (a ^ z)
- else:
- b = (b + g) % N
- a = ((a << b) | (a >> (N - b))) & e
- print(bin(a)[2:].zfill(N))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement