~php <? echo BeeMaja($n); function BeeMaja($w) { if($w<1||$w>100000) return "Error"; $x = $y = 0; for($n=1; ; $n++) { if($w==1) return "$x $y"; $w--; $y++; for($c=0; $c<$n-1&&$w>1; $c++,$x--,$y++) $w--; for($c=0; $c<$n&&$w>1; $c++,$x--) $w--; for($c=0; $c<$n&&$w>1; $c++,$y--) $w--; for($c=0; $c<$n&&$w>1; $c++,$x++,$y--) $w--; for($c=0; $c<$n&&$w>1; $c++,$x++) $w--; for($c=0; $c<$n&&$w>1; $c++,$y++) $w--; } } ?>