diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
| commit | e5e8007197489a84d2fc3c499efe822642ba682e (patch) | |
| tree | 72666ca39016efa3df9efaee3e9eaa88ad18d8e9 /2025/11/a.py | |
| parent | f8944a95b16e2b09ad0d1b61ee5ba37d2755807f (diff) | |
| download | aoc-e5e8007197489a84d2fc3c499efe822642ba682e.tar.gz aoc-e5e8007197489a84d2fc3c499efe822642ba682e.zip | |
Day 11 2025
Diffstat (limited to '2025/11/a.py')
| -rw-r--r-- | 2025/11/a.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/2025/11/a.py b/2025/11/a.py index 5fdb11b..cf06b6a 100644 --- a/2025/11/a.py +++ b/2025/11/a.py | |||
| @@ -1,6 +1,12 @@ | |||
| 1 | import fileinput | 1 | import fileinput |
| 2 | 2 | ||
| 3 | a = {} | ||
| 3 | with fileinput.input() as lines: | 4 | with fileinput.input() as lines: |
| 4 | for line in lines: | 5 | for line in lines: |
| 5 | ... | 6 | v, l2 = line[:-1].split(': ') |
| 7 | a[v] = l2.split(' ') | ||
| 6 | 8 | ||
| 9 | def np(v): | ||
| 10 | return 1 if v == 'out' else sum(np(w) for w in a[v]) | ||
| 11 | |||
| 12 | print(np('you')) | ||
