結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
|
提出日時 | 2025-08-31 08:42:21 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 915 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 8,064 KB |
実行使用メモリ | 13,184 KB |
最終ジャッジ日時 | 2025-08-31 08:42:26 |
合計ジャッジ時間 | 3,568 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 17 |
コンパイルメッセージ
Syntax OK
ソースコード
x=gets.to_i y=gets.to_i distance=gets.to_f order=0 def custom_round(num) if num < 1 return 1 else return num.floor end end if x == 0 && y == 0 puts order elsif y == 0 && x > 0 order += 1 puts order + custom_round(x / distance) elsif y == 0 && x < 0 order += 1 puts order + custom_round(x.abs / distance) elsif x == 0 && y > 0 puts order + custom_round(y / distance) elsif x == 0 && y < 0 order += 2 puts order + custom_round(y.abs / distance) elsif x > 0 && y > 0 order += 1 puts order + custom_round(x / distance) + custom_round(y / distance) elsif x < 0 && y > 0 order += 2 puts order + custom_round(x.abs / distance) + custom_round(y / distance) elsif x < 0 && y < 0 order += 2 puts order + custom_round(x.abs / distance) + custom_round(y.abs / distance) elsif x > 0 && y < 0 order += 2 puts order + custom_round(x / distance) + custom_round(y.abs / distance) end