blob: 8e9c6a172925fe5db0485dd77585e6238d286585 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.016;
my @s1 = map { int($_ * 1000000) } split ' ', <>;
my @s2 = map { int($_ * 1000000) } split ' ', <>;
my %totals;
for my $s1 (@s1) {
for my $s2 (@s2) {
say "$s1 $s2" if $s1 - $s2 < 8600000 && $s1 - $s2 > 8500000;
$totals{$s1 - $s2}++;
}
}
my %convolution = reverse %totals;
my $max = (sort { $a <=> $b } keys %convolution)[-1];
say $max;
say abs($convolution{$max}) / 1000000;
|