Remove bad print in 2023 day 21.
This commit is contained in:
parent
46558672e8
commit
781e4cd6e1
@ -102,32 +102,31 @@ class Solver(BaseSolver):
|
||||
# depending on the number of cycles, either A or B will be in the center
|
||||
#
|
||||
|
||||
counts = [
|
||||
[
|
||||
sum(
|
||||
(i, j) in tiles
|
||||
for i in range(ci * cycle, (ci + 1) * cycle)
|
||||
for j in range(cj * cycle, (cj + 1) * cycle)
|
||||
)
|
||||
for cj in range(-2, 3)
|
||||
]
|
||||
for ci in range(-2, 3)
|
||||
]
|
||||
# counts = [
|
||||
# [
|
||||
# sum(
|
||||
# (i, j) in tiles
|
||||
# for i in range(ci * cycle, (ci + 1) * cycle)
|
||||
# for j in range(cj * cycle, (cj + 1) * cycle)
|
||||
# )
|
||||
# for cj in range(-2, 3)
|
||||
# ]
|
||||
# for ci in range(-2, 3)
|
||||
# ]
|
||||
|
||||
radius = (26501365 - rhombus) // cycle - 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]
|
||||
answer_2 = (
|
||||
(radius + 1) * A
|
||||
+ radius * B
|
||||
+ 2 * radius * (radius + 1) // 2 * A
|
||||
+ 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, 1), (0, 3), (-1, 1), (-1, 3)))
|
||||
* (radius + 1)
|
||||
+ 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}")
|
||||
# radius = (26501365 - rhombus) // cycle - 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]
|
||||
# answer_2 = (
|
||||
# (radius + 1) * A
|
||||
# + radius * B
|
||||
# + 2 * radius * (radius + 1) // 2 * A
|
||||
# + 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, 1), (0, 3), (-1, 1), (-1, 3)))
|
||||
# * (radius + 1)
|
||||
# + sum(counts[i][j] for i, j in ((1, 1), (1, 3), (-2, 1), (-2, 3))) * radius
|
||||
# )
|
||||
|
||||
# version 2: fitting a polynomial
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user