結果

問題 No.586 ダブルブッキング
ユーザー simansiman
提出日時 2020-06-09 15:48:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 11,312 KB
実行使用メモリ 15,240 KB
最終ジャッジ日時 2023-08-30 15:52:34
合計ジャッジ時間 2,234 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,152 KB
testcase_01 AC 80 ms
15,140 KB
testcase_02 AC 80 ms
15,128 KB
testcase_03 AC 80 ms
15,240 KB
testcase_04 AC 80 ms
15,044 KB
testcase_05 AC 81 ms
15,176 KB
testcase_06 AC 79 ms
15,128 KB
testcase_07 AC 79 ms
15,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

P1 = gets.to_i
P2 = gets.to_i
N = gets.to_i
R = N.times.map { gets.to_i }

checked = Hash.new(false)
profit = 0
debt = 0

R.each do |r|
  if checked[r]
    debt += P1 + P2
  else
    profit += P1
  end

  checked[r] = true
end

puts debt
0