-
Notifications
You must be signed in to change notification settings - Fork 0
/
arr.py
72 lines (59 loc) · 1.53 KB
/
arr.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def r():
nq = input().strip()
n, q = int(nq.split()[0].strip()), int(nq.split()[1].strip())
dic = {0: [], 1: []}
last_answer = 0
for i in range(0, q):
inp = input()
seq_str = inp.strip().split()
s = [int(a) for a in seq_str]
b = (bool(s[1]) ^ bool(last_answer)) % n
print('b: {}'.format(b))
if s[0] == 1:
dic[b].append(s[-1])
elif s[0] == 2:
position = s[-1] % len(dic[b])
last_answer = dic[b][position]
print(last_answer)
print(dic[0], dic[1])
# def f():
# for i in range(1,5):
# print(int(i*'1')**2)
def wonder(s):
try:
if int(s) % 2:
val = int(s) + 500
else:
val = int(s) + 1000
except Exception:
if s.islower():
val = ord(s)
else:
val = ord(s) + 100
return val
w = sorted(s, key=wonder)
print(*w, sep='')
def capitalize(string):
ss = string.split(' ')
new_s = []
for s in ss:
c = s[0].upper() + s[1:]
new_s.append(c)
return ' '.join(new_s)
# def rangoli():
a = 5
for i in reversed(list(range(a))):
for j in range(a):
alphs = 'abcdefghijklmnopqrstuvwxyz'
n = 5
b = (2*n) -1
for i in range(b):
lis = []
for j in reversed(list(range(b))):
z = min(abs(b-i-1), i)
y = min(abs(b-j-1), j)
var = '-'
if j in range((n-1)-z, n+z):
var = alphs[b-(y+z) -1]
lis.append(var)
print(lis)