aboutsummaryrefslogtreecommitdiff
path: root/2025/01/b.py
blob: 3ef4a9db1c7694c7f6399d2479735fcb70dfde46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import fileinput

p = 50
c = 0
with fileinput.input() as lines:
	for line in lines:
		oldp = p
		s = 1 if line[0] == "R" else -1
		p += s * int(line[1:])
		c += abs(p) // 100 + (1 if p <= 0 and oldp != 0 else 0)
		p %= 100

print(c)

Generated with cgit - Back to sebastiano.tronto.net