結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2017-09-08 00:14:44 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 87 ms / 5,000 ms |
コード長 | 983 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-07 11:52:47 |
合計ジャッジ時間 | 3,153 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
Syntax OK
ソースコード
class PilotRobotattr_reader :x, :y, :ldef initialize(x: 0, y: 0, l: 0)@x, @y, @l = x, y, lenddef datainputbegin@x = Integer(gets.chomp)@y = Integer(gets.chomp)@l = Integer(gets.chomp)rescueendenddef pilot(x, y, l)return 0 if x == 0 and y == 0action = 0# y方向の移動action += y.abs / laction += 1 if (y.abs % l) != 0# x方向の移動action += x.abs / laction += 1 if (x.abs % l) != 0# x方向の回転action += 1 if x != 0# y方向の回転if y < 0action += 1action += 1 if x == 0endreturn actionenddef dataoutputputs pilot(@x, @y, @l)enddef rundatainputdataoutputendendif $0 == __FILE__PilotRobot.new.runend