first few days

This commit is contained in:
Ben Charlton 2018-12-04 22:46:54 +00:00
parent 8764f51187
commit d3ae65f625
12 changed files with 343 additions and 0 deletions

13
1/1.pl Normal file
View file

@ -0,0 +1,13 @@
#!/usr/bin/perl
use strict;
my $start = 0;
while (<>) {
chomp;
$start += $_;
}
print $start . "\n";

19
1/2.pl Normal file
View file

@ -0,0 +1,19 @@
#!/usr/bin/perl
use strict;
my $freq = 0;
my %seen;
chomp (my @data = <STDIN>);
while () {
foreach (@data) {
$freq += $_;
if ($seen{$freq} == 1) {
print $freq . "\n";
exit;
}
$seen{$freq}++;
}
}