Browse Source

add day 7 bigboy

master
mid-kid 4 years ago
parent
commit
f95351b453
  1. 10
      d07.py
  2. 53100
      d07_bigboy.txt
  3. 2
      d07_bigboy_output.txt

10
d07.py

@ -28,14 +28,20 @@ def add(x):
o.add(x) o.add(x)
if x in r: if x in r:
for c in r[x]: for c in r[x]:
add(c) if c not in o:
add(c)
add("shiny gold") add("shiny gold")
print(len(o)-1) print(len(o)-1)
ch = {}
def add(x): def add(x):
o = 1 o = 1
for c in b[x]: for c in b[x]:
o += add(c)*b[x][c] if c in ch:
o += ch[c]*b[x][c]
else:
o += add(c)*b[x][c]
ch[x] = o
return o return o
o = add("shiny gold") o = add("shiny gold")
print(o-1) print(o-1)

53100
d07_bigboy.txt

File diff suppressed because it is too large

2
d07_bigboy_output.txt

@ -0,0 +1,2 @@
1451
194862000331161060077692164361250087392422885313733903570125256040310600470702402146499147239740937896847422561263507998724051435182586624471506934870477964081846250347048098669626231789017394259075312269423716991209650967618059382711559732444416809308192760721424092727476075
Loading…
Cancel
Save