From 54350d120ff81743476fa851a2f049b3f50f617f Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Sat, 2 Dec 2017 16:34:42 +0000 Subject: Day 02 --- day02/part1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 day02/part1 (limited to 'day02/part1') diff --git a/day02/part1 b/day02/part1 new file mode 100755 index 0000000..b63cec1 --- /dev/null +++ b/day02/part1 @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +cs = 0 + +input = $stdin.readlines.map(&:chomp) + +input.each do |line| + nums = line.split.map(&:to_i) + cs += nums.max - nums.min +end + +puts cs -- cgit v1.2.3