結果

問題 No.48 ロボットの操縦
ユーザー abinullabinull
提出日時 2021-12-14 01:11:54
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 254 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 11,512 KB
実行使用メモリ 15,576 KB
最終ジャッジ日時 2023-09-30 07:18:10
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 80 ms
15,296 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 80 ms
15,156 KB
testcase_08 AC 82 ms
15,252 KB
testcase_09 AC 82 ms
15,268 KB
testcase_10 AC 81 ms
15,264 KB
testcase_11 AC 82 ms
15,068 KB
testcase_12 AC 82 ms
15,156 KB
testcase_13 AC 81 ms
15,164 KB
testcase_14 AC 82 ms
15,300 KB
testcase_15 AC 83 ms
15,256 KB
testcase_16 AC 81 ms
15,040 KB
testcase_17 AC 82 ms
15,148 KB
testcase_18 AC 81 ms
15,256 KB
testcase_19 AC 83 ms
15,312 KB
testcase_20 AC 82 ms
15,180 KB
testcase_21 AC 83 ms
15,120 KB
testcase_22 AC 83 ms
15,144 KB
testcase_23 AC 82 ms
15,368 KB
testcase_24 AC 83 ms
15,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

x = gets.chomp!.to_i.abs
y = gets.chomp!.to_i
l = gets.chomp!.to_i

inst = (x / l) + ((x % l) / (x % l))
inst += (y.abs / l) + ((y.abs % l) / (y.abs % l))
inst += 1 if x != 0 && y >= 0
inst += 2 if x == 0 && y < 0
inst += 2 if x != 0 && y < 0

puts inst
0