diff options
Diffstat (limited to '2025/06/a.py')
| -rw-r--r-- | 2025/06/a.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/2025/06/a.py b/2025/06/a.py index 1d12e01..c9707ab 100644 --- a/2025/06/a.py +++ b/2025/06/a.py | |||
| @@ -13,8 +13,7 @@ with fileinput.input() as lines: | |||
| 13 | a.append([int(x) for x in t if x != '']) | 13 | a.append([int(x) for x in t if x != '']) |
| 14 | 14 | ||
| 15 | def sol(a, op, i): | 15 | def sol(a, op, i): |
| 16 | return (sum(a[j][i] for j in range(len(a))) if op[i] == '+' | 16 | col = [a[j][i] for j in range(len(a))] |
| 17 | else reduce(mul, (a[j][i] for j in range(len(a))), 1)) | 17 | return sum(col) if op[i] == '+' else reduce(mul, col, 1) |
| 18 | |||
| 19 | 18 | ||
| 20 | print(sum(sol(a, op, i) for i in range(len(a[0])))) | 19 | print(sum(sol(a, op, i) for i in range(len(a[0])))) |
