結果

問題 No.48 ロボットの操縦
ユーザー code-devocode-devo
提出日時 2016-01-06 15:03:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 262 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 11,176 KB
実行使用メモリ 15,372 KB
最終ジャッジ日時 2023-08-14 00:19:50
合計ジャッジ時間 3,289 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,112 KB
testcase_01 AC 80 ms
15,336 KB
testcase_02 AC 82 ms
15,080 KB
testcase_03 AC 81 ms
15,076 KB
testcase_04 AC 82 ms
15,144 KB
testcase_05 AC 81 ms
15,300 KB
testcase_06 AC 81 ms
15,072 KB
testcase_07 AC 80 ms
15,076 KB
testcase_08 AC 83 ms
15,284 KB
testcase_09 AC 87 ms
15,120 KB
testcase_10 AC 82 ms
15,292 KB
testcase_11 AC 82 ms
15,056 KB
testcase_12 AC 79 ms
15,160 KB
testcase_13 AC 80 ms
15,000 KB
testcase_14 AC 80 ms
15,360 KB
testcase_15 AC 80 ms
15,120 KB
testcase_16 AC 79 ms
15,132 KB
testcase_17 AC 79 ms
15,372 KB
testcase_18 AC 80 ms
15,052 KB
testcase_19 AC 81 ms
15,052 KB
testcase_20 AC 80 ms
15,004 KB
testcase_21 AC 82 ms
15,052 KB
testcase_22 AC 81 ms
15,312 KB
testcase_23 AC 80 ms
15,308 KB
testcase_24 AC 80 ms
15,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

x, y, l = $stdin.read.split.map(&:to_i)
x = x.abs

count = 0
count += (y / l.to_f).ceil if y > 0 #北へ前進
count += 1 + (x / l.to_f).ceil if y < 0 || x > 0 #右1回転+東へ前進
count += 1 + (-y / l.to_f).ceil if y < 0 #右1回転+南へ前進
puts count
0