2015-01
This commit is contained in:
parent
eebed65b33
commit
14029d26a5
4
2015/01/d1.pl
Normal file
4
2015/01/d1.pl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
use 5.20.0;
|
||||||
|
|
||||||
|
say eval <> =~ s/\(/+1/gr =~ s/\)/-1/gr;
|
||||||
|
|
10
2015/01/d1b.pl
Normal file
10
2015/01/d1b.pl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use 5.20.0;
|
||||||
|
use List::AllUtils qw/ reduce /;
|
||||||
|
|
||||||
|
my $i;
|
||||||
|
reduce {
|
||||||
|
my $l = $a + ( $b eq '(' ? 1 : -1 );
|
||||||
|
$i++;
|
||||||
|
die $i if $l < 0;
|
||||||
|
$l;
|
||||||
|
} 0, split '', <>;
|
Loading…
Reference in New Issue
Block a user