From d21e58f81d28b4e411f1188b1fa065b99e24378b Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Tue, 5 Dec 2017 09:35:09 +0000 Subject: Day05 --- day05/part1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 day05/part1 (limited to 'day05/part1') diff --git a/day05/part1 b/day05/part1 new file mode 100755 index 0000000..0d0b4ec --- /dev/null +++ b/day05/part1 @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +input = $stdin.readlines.map(&:chomp).map(&:to_i) +pc = 0 +steps = 0 + +while pc >= 0 && pc < input.length do + newpc = pc + input[pc] + input[pc] += 1 + pc = newpc + steps += 1 +end + +puts steps -- cgit v1.2.3