I don't have any motivation left in my brain… I will lie on the bed.
Simply keep adding two points on both sides centered with the given point.
1 <= k <= 1000
and
-100 <= xc, yc <= 100
, so this approach does not make
xi
and yi
exceed the limit.
In hindsight, the solve() function seems to be confusing, but I'll let it as it is. I hope I can write more readable code next time.
def solve(xc: int, yc: int, k: int) -> list[tuple[int, int]]:
ans: list[tuple[int, int]] = []
if k % 2 == 1:
ans.append((xc, yc))
k -= 1
ce: int = 1
while k > 0:
ans.append((xc - ce * k, yc - ce * k))
ans.append((xc + ce * k, yc + ce * k))
k -= 2
return ans
for _ in range(int(input())):
xc, yc, k = map(int, input().split())
ans: list[tuple[int, int]] = solve(xc, yc, k)
assert len(ans) == k
assert sum([x for x, y in ans]) // k == xc
assert sum([y for x, y in ans]) // k== yc
for x, y in ans:
print(f"{x} {y}")
Ketone 60 mg/dl
Salad 40g Meat 0g Protein shake 20g
Total carbohydrate 60 g
MUST:
TODO: