結果

問題 No.48 ロボットの操縦
ユーザー DevbotBot
提出日時 2015-06-25 17:46:39
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 32,020 KB
実行使用メモリ 32,404 KB
最終ジャッジ日時 2024-07-07 17:36:42
合計ジャッジ時間 6,936 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 1 TLE * 1 -- * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
	$x = trim(fgets(STDIN));
	$y = trim(fgets(STDIN));
	$l = trim(fgets(STDIN));
	$x = abs($x);
	$y = abs($y);
	$i = 0;
	$compass = 0;
	$move = 0;
	if ( $y < 0 ) {
		$compass++;
	}

	if ( $x != 0 ) {
		$compass++;
	}

	for ($i = 0; $i < $x; $i++) {
			if ($l * $i < $x) {
			$move++;
		}
	}

	for ($i = 0;  $i < $y; $i++ ){
		if ($l * $i < $y){
			$move++;
		}
	}
	echo (($move + $compass) . "\n");
0