mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 21:30:31 +01:00
Solution to day 25.
This commit is contained in:
18
day-25/solution.py
Normal file
18
day-25/solution.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
def findCode(n):
|
||||||
|
modBase = 33554393
|
||||||
|
base = 252533
|
||||||
|
start = 20151125
|
||||||
|
|
||||||
|
code = start * pow(base, n - 1, modBase)
|
||||||
|
return code % modBase
|
||||||
|
|
||||||
|
row = 2947
|
||||||
|
col = 3029
|
||||||
|
|
||||||
|
triangleNo = row + col - 1
|
||||||
|
subTriangleSurface = ((triangleNo - 1) * triangleNo) // 2
|
||||||
|
n = subTriangleSurface + col
|
||||||
|
|
||||||
|
print(findCode(n))
|
||||||
Reference in New Issue
Block a user