From b880d35aba91fd5c9a8a696705914d44da77e508 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Mon, 18 Dec 2017 22:33:34 +0000 Subject: Day17 Part1 --- day17/input | 1 + day17/part1 | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 day17/input create mode 100755 day17/part1 (limited to 'day17') diff --git a/day17/input b/day17/input new file mode 100644 index 0000000..8661997 --- /dev/null +++ b/day17/input @@ -0,0 +1 @@ +328 diff --git a/day17/part1 b/day17/part1 new file mode 100755 index 0000000..e1c5027 --- /dev/null +++ b/day17/part1 @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +input = gets.chomp.to_i + +buf = [0] +pos = 0 + +2017.times do |num| + pos = ((pos + input) % buf.length) + 1 + buf.insert(pos, num + 1) +end + +p buf[pos + 1] -- cgit v1.2.3