blob: 4abe8998311513c772bcefb6e20d986d1bf3666b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/awk -f
function fuel(n)
{
n = int(n / 3) - 2
# START PART 1
return n
# END PART 1 START PART 2
return n <= 0 ? 0 : n + fuel(n)
# END PART 2
}
{ n += fuel($1) }
END { print n }
|