<>A Arrange letters

s='WHERETHEREISAWILLTHEREISAWAY' s=list(s) s.sort() print(''.join(s))
#AAAEEEEEEHHHIIILLRRRSSTTWWWY
<>B Find integer

answer :2022040920220409

thinking : Chinese remainder theorem should be able to do , But I can't remember what I wrote during the game , Just a wave of violence . be careful , You can't add up one by one , Own use python Calculate it pow(10,17) I'll know . I chose the last five numbers , Because these are relatively large , First find the law that can satisfy these five numbers at the same time :

tmp.py
i=1 while True: flag=True if i%49!=46: flag=False if i%48!=41: flag=False if i%
47!=5: flag=False if i%46!=15: flag=False if i%45!=29: flag=False if flag: print
(i) i+=1
Just run out a few times :4772009, 42909689, 81047369, 119185049,157322729, 195460409,
233598089…… Needless to say, it must be an arithmetic sequence , A little more verification y=38137680*x+4772009

Then enumerate that x Value of , Then traverse whether the previous is satisfied , So you can run out :

B.py
mod = [(2, 1), (14, 11), (26, 23), (38, 37), (3, 2), (15, 14), (27, 20), (39,
23), (4, 1), (16, 9), (28, 25), (40, 9), (5, 4), (17, 0), (29, 16), (41, 1), (6,
5), (18, 11), (30, 29), (42, 11), (7, 4), (19, 18), (31, 27), (43, 11), (8, 1),
(20, 9), (32, 25), (44, 33), (9, 2), (21, 11), (33, 11), (45, 29), (10, 9), (22,
11), (34, 17), (46, 15), (11, 0), (23, 15), (35, 4), (47, 5), (12, 5), (24, 17),
(36, 29), (48, 41), (13, 10), (25, 9), (37, 22)] i = 0 cha = 38137680 while True
: flag = True num = cha*i+4772009 for x, y in mod: if num % x != y: flag = False
break if flag: print(num) break i += 1 # 2022040920220409
<>C Paper size

There's nothing to say , Long edge Division 2 that will do
name = input() A0x, A0y = 1189, 841 if name == 'A0': print(A0x) print(A0y) else
: cnt = int(name[1]) for i in range(cnt): A0x, A0y = A0y, A0x//2 print(A0x)
print(A0y)
<>D Digit sorting

As long as you can use it cmp_to_key It's not difficult
from functools import cmp_to_key def cmp(x, y): hx = getHe(x) hy = getHe(y) if
hx== hy: return x-y return hx-hy def getHe(n): res = 0 while n > 0: res += n %
10 n //= 10 return res n = int(input()) m = int(input()) num = [i for i in range
(1, n+1)] num.sort(key=cmp_to_key(cmp)) print(num[m-1])
<>E hive

No idea

<>F Elimination game

uncertain
s = list(input()) pre = s f = False for i in range(pow(2, 64)): flag = [False]*
len(s) for j in range(1, len(s)-1): if s[j] == s[j-1] and s[j] != s[j+1]: flag[j
] = True flag[j+1] = True if s[j] != s[j-1] and s[j] == s[j+1]: flag[j-1] = True
flag[j] = True for j in range(len(flag)): if flag[j]: s[j] = '' s = list(''.
join(s)) if len(s) == 0: f = True break if pre == s: break pre = s if f: print(
'EMPTY') else: print(''.join(s))
<>G Full Permutation value

Wrote a little , It's a shame not to let it out

<>H Skill upgrading

The maximum value of the heap should be optimized , The time complexity can be reduced to nlogn, Forgot to optimize during the game , Woo woo
from math import ceil n, m = map(int, input().split()) a = [0] b = [0] dp = [0]
*(m+1) for i in range(n): x, y = map(int, input().split()) a.append(x) b.append(
y) for j in range(1, m+1): index = 0 for k in range(1, n+1): if a[k] > a[index]:
index= k dp[j] = dp[j-1]+a[index] a[index] -= b[index] a[index] = max(a[index],
0) print(dp[m])
<>I Longest non descending subsequence

Wrote a little , It's a shame not to let it out

<>J Optimal clearing scheme

Technology