s = "WHERETHEREISAWILLTHEREISAWAY" arr = [] for i in s: arr.append(i)
arr.sort() for i in arr: print(i, end="")

import math s = input() num = int(s.split("A")[1]) A0 = [1189, 841] tmp =
A0.copy() for i in range(num): tmp = [tmp[1], math.floor(float(tmp[0]) / 2.0)]
print(tmp[0]) print(tmp[1])

n = int(input()) m = int(input()) arr = [[1, 1]] def get_sum(num): m = 0 s =
10 while True: if num == 0: break m += num % s num = num // s return m for i in
range(2, n + 1): x = get_sum(i) flag = False tmp = arr.copy() for j, v in
enumerate(arr): if x < v[0]: tmp.insert(j, [x, i]) flag = True break elif x ==
v[0]: if i < v[1]: tmp.insert(j, [x, i]) flag = True break if not flag:
tmp.append([x, i]) arr = tmp.copy() print(arr[m - 1][1])

这个题，我觉得就是每次先找出来边缘字符，然后将边缘字符的索引存入一个列表，然后根据这个列表去删除边缘字符，然后不断循环，直到为空，或者一次循环没有变化为止
s = input() arr = [] for i in s: arr.append(i) tmp = set() i = pow(2, 64)
while True: for i in range(len(arr)): if i + 1 < len(arr) and i - 1 >= 0 and
arr[i - 1] == arr[i] and arr[i] != arr[i + 1]: tmp.add(i) tmp.add(i + 1) elif i
+ 1 < len(arr) and i - 1 >= 0 and arr[i] == arr[i + 1] and arr[i - 1] !=
arr[i]: tmp.add(i - 1) tmp.add(i) count = 0 if tmp == set(): break while tmp !=
set(): v = tmp.pop() arr.pop(v - count) count += 1 tmp.clear() if arr == []:
break if i == 0: break i = i - 1 if arr == []: print("EMPTY") else: for i in
arr: print(i, end="")

这个题我用的笨方法，先用itertools 里面的方法，把全部全排列求出来，然后遍历全排列，然后求解，也不确定对不对
import itertools n = int(input()) t = [i + 1 for i in range(n)] arr =
list(itertools.permutations(t)) count = 0 for i in arr: for j in range(1,
len(i)): for k in range(0, j): if i[k] < i[j]: count += 1 print(count %
998244353)

string = input() arr = string.split(" ") N, M = int(arr[0]), int(arr[1]) alls
= [] for i in range(N): str1 = input().split(" ") tmp = [] for j in str1:
tmp.append(int(j)) alls.append(tmp) s = 0 while True: x = {"m": 0, "index": 0}
tmp = x["m"] for i in range(len(alls)): t = alls[i][0] if t > x["m"]: x["m"] =
alls[i][0] x["index"] = i if x["m"] < tmp: break s += x["m"]
alls[x["index"]][0] -= alls[x["index"]][1] M -= 1 if M == 0: break print(s)

str1 = input() nums = [int(i) for i in str1.split(" ")] n = nums[0] k =
nums[1] string = input() strs = string.split(" ") arr = [int(i) for i in strs]
count = 0 for i in range(len(arr)): if k > 0: while True: if arr[i] == 0: break
flag = True if k + i < len(arr) + 1: for j in range(i, k + i): if arr[j] < 0:
flag = False if flag and k + i < len(arr) + 1: for j in range(i, k + i): arr[j]
-= 1 count += 1 else: while True: arr[i] -= 1 count += 1 if arr[i] == 0: break
else: while True: if arr[i] == 0: break arr[i] -= 1 count += 1 print(count)