結果

問題 No.63 ポッキーゲーム
ユーザー Makot3Makot3
提出日時 2017-07-01 07:36:37
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,233 ms / 5,000 ms
コード長 238 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 11,104 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-08-25 19:33:41
合計ジャッジ時間 7,171 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,248 KB
testcase_01 AC 85 ms
15,092 KB
testcase_02 AC 82 ms
15,092 KB
testcase_03 AC 82 ms
15,132 KB
testcase_04 AC 83 ms
15,016 KB
testcase_05 AC 84 ms
15,188 KB
testcase_06 AC 82 ms
15,264 KB
testcase_07 AC 85 ms
15,296 KB
testcase_08 AC 83 ms
15,204 KB
testcase_09 AC 99 ms
15,092 KB
testcase_10 AC 242 ms
15,192 KB
testcase_11 AC 81 ms
15,076 KB
testcase_12 AC 402 ms
15,008 KB
testcase_13 AC 82 ms
15,160 KB
testcase_14 AC 412 ms
15,188 KB
testcase_15 AC 403 ms
15,300 KB
testcase_16 AC 122 ms
15,084 KB
testcase_17 AC 82 ms
15,016 KB
testcase_18 AC 109 ms
15,220 KB
testcase_19 AC 2,233 ms
15,260 KB
testcase_20 AC 79 ms
15,160 KB
testcase_21 AC 752 ms
15,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

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