]> www.fi.muni.cz Git - aoc.git/blob - 2018/02.pl
Day 25: examining the input
[aoc.git] / 2018 / 02.pl
1 #!/usr/bin/perl -w
2
3 use v5.30;
4 use strict;
5
6 my %seen;
7 my $freq = 0;
8 chomp(my @changes = <>);
9 while (1) {
10         for my $x (@changes) {
11                 $freq += $x;
12                 if ($seen{$freq}++) {
13                         say $freq;
14                         exit 0;
15                 }
16         }
17 }
18
19
20