結果
| 問題 | 
                            No.63 ポッキーゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-07-01 07:36:37 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2,002 ms / 5,000 ms | 
| コード長 | 238 bytes | 
| コンパイル時間 | 56 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,416 KB | 
| 最終ジャッジ日時 | 2024-12-24 05:34:12 | 
| 合計ジャッジ時間 | 6,407 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
Main.rb:10: warning: `-' after local variable or literal is interpreted as binary operator Main.rb:10: warning: even though it seems like unary operator Main.rb:12: warning: mismatched indentations at 'end' with 'else' at 6 Syntax OK
ソースコード
l, k = gets.split(' ').map(&:to_i)
k2 = k * 2
if k == 1
 if k2 > l
   puts 0
 else
   if l % k2 != 0
     puts l / k2
   else
     puts (l / k2) -1
   end
  end
else
  i = 0
  while l - k2 > 0
    l -= k2
    i += 1
  end
  puts k * i
end