X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=35.pl;fp=35.pl;h=5582de317d9ebca276b76cfc1bcd05e4f8fce75e;hb=ad27dd52fd6e2e560706e17376bdf609e9bcc8a1;hp=0000000000000000000000000000000000000000;hpb=8f222dad784fdcc74a5051370035ba79273409d4;p=aoc2020.git diff --git a/35.pl b/35.pl new file mode 100755 index 0000000..5582de3 --- /dev/null +++ b/35.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl -w + +use strict; + +my $sum = 0; +while (<>) { + chomp; + 1 while + s/\((\d+)\)/$1/ || + s/(\d+)\s*([\+\*])\s*(\d+)/"$1$2$3"/ee; + $sum += $_; +} +print "sum=$sum\n";