summaryrefslogtreecommitdiffstats
path: root/25
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-11-27 13:39:28 +0000
committerTomasz Kramkowski <tk@the-tk.com>2021-11-27 13:39:28 +0000
commitac1b99879c191770085c43dcdb13027b44eae84c (patch)
treecb3ea9123dc4a1c46f961d249741e0a426a3b87d /25
parent515c7bff241144022a5a10b8e984c7bd90ba0c90 (diff)
downloadaoc2015-ac1b99879c191770085c43dcdb13027b44eae84c.tar.gz
aoc2015-ac1b99879c191770085c43dcdb13027b44eae84c.tar.xz
aoc2015-ac1b99879c191770085c43dcdb13027b44eae84c.zip
all done
Diffstat (limited to '25')
-rw-r--r--25/solution.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/25/solution.py b/25/solution.py
new file mode 100644
index 0000000..6322ee4
--- /dev/null
+++ b/25/solution.py
@@ -0,0 +1,19 @@
+def part1(row, col):
+ row -= 1
+ col -= 1
+
+ n = row + col
+ n = n * (n + 1) // 2 + col
+
+ code = 20151125
+ for i in range(n):
+ code = code * 252533 % 33554393
+ return code
+
+if __name__ == '__main__':
+ row = 2978
+ col = 3083
+
+ print(part1(1, 1))
+ print(part1(3, 4))
+ print(part1(row, col))