day 11 part 1
parent
ad6279089f
commit
0e13af40c5
|
@ -0,0 +1 @@
|
|||
6563348 67 395 0 6 4425 89567 739318
|
|
@ -0,0 +1,20 @@
|
|||
Initial arrangement:
|
||||
125 17
|
||||
|
||||
After 1 blink:
|
||||
253000 1 7
|
||||
|
||||
After 2 blinks:
|
||||
253 0 2024 14168
|
||||
|
||||
After 3 blinks:
|
||||
512072 1 20 24 28676032
|
||||
|
||||
After 4 blinks:
|
||||
512 72 2024 2 0 2 4 2867 6032
|
||||
|
||||
After 5 blinks:
|
||||
1036288 7 2 20 24 4048 1 4048 8096 28 67 60 32
|
||||
|
||||
After 6 blinks:
|
||||
2097446912 14168 4048 2 0 2 4 40 48 2024 40 48 80 96 2 8 6 7 6 0 3 2
|
|
@ -0,0 +1,21 @@
|
|||
def solve(file):
|
||||
nums = file.read().split()
|
||||
|
||||
for i in range(25):
|
||||
if len(nums) < 100:
|
||||
print(i, nums)
|
||||
new = []
|
||||
for n in nums:
|
||||
if n == '0':
|
||||
new.append('1')
|
||||
elif len(n)%2 == 0:
|
||||
new.append(n[:len(n)//2])
|
||||
new.append(n[len(n)//2:].lstrip('0') or '0')
|
||||
else:
|
||||
new.append(str(int(n)*2024))
|
||||
nums = new
|
||||
print(len(nums))
|
||||
|
||||
from io import StringIO
|
||||
solve(StringIO("0 1 10 99 999"))
|
||||
solve(open("input"))
|
Loading…
Reference in New Issue