It's possible to make the tower height m
if the
remaining moves are couples of (+1, -1)
.
def possible_math(n: int, m: int) -> bool:
if n < m:
return False
return (n - m) % 2 == 0
def possible_greedy(n: int, m: int) -> bool:
for i in range(1, n + 1):
if m == i - (n - i):
return True
return False
for _ in range(int(input())):
n, m = map(int, input().split())
if possible_math(n, m):
print("YES")
else:
print("NO")
for _ in range(int(input())):
n: int = int(input())
b: list[str] = list(input())
r: list[str] = sorted(list(set(b)))
mapping: dict[str, str] = {}
for i in range(len(r)):
mapping[r[i]] = r[-(i + 1)] # This might come in handy in the future..
for i in range(n):
b[i] = mapping[b[i]]
print("".join(b))
Salad 400 Sushi bowl 900 Protein shake 400
Total 1700 kcal
MUST:
TODO: