Remove bad print in 2023 day 21.

This commit is contained in:
Mikael CAPELLE 2024-12-10 16:22:03 +01:00
parent 46558672e8
commit 781e4cd6e1

View File

@ -102,32 +102,31 @@ class Solver(BaseSolver):
# depending on the number of cycles, either A or B will be in the center # depending on the number of cycles, either A or B will be in the center
# #
counts = [ # counts = [
[ # [
sum( # sum(
(i, j) in tiles # (i, j) in tiles
for i in range(ci * cycle, (ci + 1) * cycle) # for i in range(ci * cycle, (ci + 1) * cycle)
for j in range(cj * cycle, (cj + 1) * cycle) # for j in range(cj * cycle, (cj + 1) * cycle)
) # )
for cj in range(-2, 3) # for cj in range(-2, 3)
] # ]
for ci in range(-2, 3) # for ci in range(-2, 3)
] # ]
radius = (26501365 - rhombus) // cycle - 1 # radius = (26501365 - rhombus) // cycle - 1
A = counts[2][2] if radius % 2 == 0 else counts[2][1] # A = counts[2][2] if radius % 2 == 0 else counts[2][1]
B = counts[2][2] if radius % 2 == 1 else counts[2][1] # B = counts[2][2] if radius % 2 == 1 else counts[2][1]
answer_2 = ( # answer_2 = (
(radius + 1) * A # (radius + 1) * A
+ radius * B # + radius * B
+ 2 * radius * (radius + 1) // 2 * A # + 2 * radius * (radius + 1) // 2 * A
+ 2 * radius * (radius - 1) // 2 * B # + 2 * radius * (radius - 1) // 2 * B
+ sum(counts[i][j] for i, j in ((0, 2), (-1, 2), (2, 0), (2, -1))) # + sum(counts[i][j] for i, j in ((0, 2), (-1, 2), (2, 0), (2, -1)))
+ sum(counts[i][j] for i, j in ((0, 1), (0, 3), (-1, 1), (-1, 3))) # + sum(counts[i][j] for i, j in ((0, 1), (0, 3), (-1, 1), (-1, 3)))
* (radius + 1) # * (radius + 1)
+ sum(counts[i][j] for i, j in ((1, 1), (1, 3), (-2, 1), (-2, 3))) * radius # + sum(counts[i][j] for i, j in ((1, 1), (1, 3), (-2, 1), (-2, 3))) * radius
) # )
print(f"answer 2 (v1) is {answer_2}")
# version 2: fitting a polynomial # version 2: fitting a polynomial
# #