first few days
This commit is contained in:
parent
8764f51187
commit
d3ae65f625
12 changed files with 343 additions and 0 deletions
13
1/1.pl
Normal file
13
1/1.pl
Normal 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
19
1/2.pl
Normal 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}++;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue