U E D R , A S I H C RSS

Bee Maja/변형진

주저리

그냥 산수 문제 푸는 기분으로? = _=;;

소스코드

~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--;
	}
}
?>
----
BeeMaja
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:36
Processing time 0.0112 sec