This problem is to convert a string into a list , Call it sort method Just do it
s = "WHERETHEREISAWILLTHEREISAWAY" arr = [] for i in s: arr.append(i)
arr.sort() for i in arr: print(i, end="")

Second question , brute force , No solution ....

This question , Is to make the short side longer , Long side divided by 2 Just fine
import math s = input() num = int(s.split("A")) A0 = [1189, 841] tmp =
A0.copy() for i in range(num): tmp = [tmp, math.floor(float(tmp) / 2.0)]
print(tmp) print(tmp)

The idea is to find the sum of all digits first , Then the current value , The sum of digits is also stored in a list , Traverse the list , Just compare them in turn ,
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: tmp.insert(j, [x, i]) flag = True break elif x ==
v: if i < v: tmp.insert(j, [x, i]) flag = True break if not flag:
tmp.append([x, i]) arr = tmp.copy() print(arr[m - 1])

This question , Can not do ...

This question , I think it's to find the edge characters first every time , The index of the edge character is then stored in a list , Then delete the edge characters according to this list , Then keep cycling , Until empty , Or until there is no change in one cycle
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="")

I used a stupid way to solve this problem , First use itertools Inside method , Find out all the permutations , Then traverse the full permutation , Then solve , I'm not sure, right
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)

This question is not sure , My idea is to find the biggest upgrade every time .
string = input() arr = string.split(" ") N, M = int(arr), int(arr) 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] if t > x["m"]: x["m"] =
alls[i] x["index"] = i if x["m"] < tmp: break s += x["m"]
alls[x["index"]] -= alls[x["index"]] M -= 1 if M == 0: break print(s)

This question , Can not do ....

This question , I won't do it .. Covered
str1 = input() nums = [int(i) for i in str1.split(" ")] n = nums k =
nums 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)

Technology
Daily Recommendation
views 1