Back to task

443 symbols perl
Sat Aug 30 22:06:50 2014 gabrielmad
#!/usr/bin/perl -p
$x[$.][$-[1]]=$1while/(\d+|.)/g}{sub l{map{${$a=\$c[$_]}!~/\d/&&next,$t=$$a,map{$_=${$b=\$c[$_]};/</||/$"/&&!$o&&last;/\d/&&($t=$$a+=$_,$$b='',redo)}$_+1..$#c for 0..$#{*c=$x[$_]}}0..$#x}sub p{$i=$k=0;for(@x){$j=0;/</&&($u=\$x[$i-1][$j+4],$d=\$x[$i+1][$j+4],$$u=~/\d/&&$$d=~/\d/?($r=$$u*$$d/($$u+$$d),$_=$x[$i][$j-2],$$u=$$d='',($x[$i][$j])=/\//?(0,$x[$i+1][$j]=$r):/\\/?('',$x[$i-1][$j]=$r):$r):$k++),$j++for@$_;$i++;$o=1}$k?p():l}l;p;$_=$t


Leave a comment

Parsed as Markdown

Login to leave a comment