-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday35.py
More file actions
32 lines (25 loc) · 699 Bytes
/
day35.py
File metadata and controls
32 lines (25 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/python3
import sys
def rightRotation(a, d):
out = list(a)
a_len = len(a)
for ind, el in enumerate(a):
out[(ind + d) % a_len] = el
return out
def circularArrayRotation(a, m):
out = []
for pos in m:
out.append(a[pos])
return out
if __name__ == "__main__":
n, k, q = input().strip().split(' ')
n, k, q = [int(n), int(k), int(q)]
a = list(map(int, input().strip().split(' ')))
m = []
m_i = 0
for m_i in range(q):
m_t = int(input().strip())
m.append(m_t)
a = rightRotation(a, k)
result = circularArrayRotation(a, m)
print ("\n".join(map(str, result)))