結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-31 08:45:05 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 914 bytes |
| コンパイル時間 | 861 ms |
| コンパイル使用メモリ | 7,936 KB |
| 実行使用メモリ | 13,184 KB |
| 最終ジャッジ日時 | 2025-08-31 08:45:10 |
| 合計ジャッジ時間 | 3,448 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 12 |
コンパイルメッセージ
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.ceil
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