結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tshigi
                         | 
                    
| 提出日時 | 2016-08-01 11:22:14 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 89 ms / 5,000 ms | 
| コード長 | 338 bytes | 
| コンパイル時間 | 192 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-11-21 18:44:44 | 
| 合計ジャッジ時間 | 2,970 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
コンパイルメッセージ
Syntax OK
ソースコード
inputs = STDIN.readlines.map(&:chomp)
x = inputs[0].to_i
y = inputs[1].to_i
l = inputs[2].to_i
def operations(x, y, l)
  c = x.abs / l + (x % l == 0 ? 0 : 1) +
      y.abs / l + (y % l == 0 ? 0 : 1)
  c + case
      when x == 0 && y >= 0
        0
      when y >= 0
        1
      else
        2
      end
end
puts operations(x, y, l)
            
            
            
        
            
tshigi