Back to task

446 symbols perl
Sat Aug 30 20:59:13 2014 gabrielmad
#!/usr/bin/perl -p
$x[$.][$-[1]]=$1while/(\d+|.)/g}{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++}p()if$k;$d=1;l()}sub l{map{${$a=\$c[$_]}!~/\d/&&next,$t=$$a,map{$_=${$b=\$c[$_]};/</||/$"/&&!$d&&last;/\d/&&($t=$$a+=$_,$$b='',redo)}$_+1..$#c for 0..$#{*c=$x[$_]}}0..$#x}l;p;$_=$t


Leave a comment

Parsed as Markdown

Login to leave a comment