aboutsummaryrefslogtreecommitdiff
path: root/2025/03/b-alt.py
blob: 43e2695865795de25911c80c86e213dd17396bb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
import fileinput

def joltage(line, n):
	if n == 0:
		return 0

	x = max(line[:len(line) - (n-1)])
	return x*10**(n-1) + joltage(line[line.index(x)+1:], n-1)

with fileinput.input() as lines:
	print(sum(joltage([int(x) for x in line[:-1]], 12) for line in lines))

Generated with cgit - Back to sebastiano.tronto.net