The ordered book “Just for Fun” about Linus Torvalds and the history of Linux just arrived. I peeked inside, and I was already hooked on it. Tomorrow is a holiday. I may read the book and chill.
def solve(rms: int, b: list[int]) -> tuple[bool, list[int]]:
# 1. calculate the product of the removed numbers
bproduct = 1
for bi in b:
bproduct *= bi
if 2023 % bproduct != 0:
return False, []
removed = 2023 // bproduct
# 2. factorization in prime numbers
factors = []
while removed > 1:
for i in range(2, 2024):
if removed % i == 0:
factors.append(i)
removed //= i
# 3. append `1` to meet the number k
# `1` does not change product of the removed numbers
while len(factors) < rms:
factors.append(1)
# 4. combine factors when exceeding the number k
while len(factors) > rms:
if len(factors) == 1:
return False, []
# bug: factors = [factors[0] + factors[1]] + factors[2:]
factors = [factors[0] * factors[1]] + factors[2:]
return True, factors
for _ in range(int(input())):
n, k = map(int, input().split())
b = list(map(int, input().split()))
exists, removed = solve(k, b)
if exists:
print("YES")
print(" ".join([str(x) for x in removed]))
else:
print("NO")
low carbo diet does not suit to be extremely ripped, but in this phase, I think it is a good option.
Squid 0g 700kcal Cheese 10g 300kcal Protein shake 10g 200kcal Salad 20g 400kcal Monster 5g 0kcal Octopus 0g 300kcal meat stick 0g 100kcal
Total carbohydrate 45g (< 60g) 2000kcal
MUST:
TODO: