結果

問題 No.63 ポッキーゲーム
コンテスト
ユーザー Makot3
提出日時 2017-07-01 07:36:37
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 1,931 ms / 5,000 ms
コード長 238 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 292 ms
コンパイル使用メモリ 9,088 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2026-05-30 02:15:32
合計ジャッジ時間 6,004 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: '-' after local variable or literal is interpreted as binary operator even though it seems like unary operator
Main.rb:12: warning: mismatched indentations at 'end' with 'else' at 6
Syntax OK

ソースコード

diff #
raw source code

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
0