結果

問題 No.586 ダブルブッキング
ユーザー Lo_OTLo_OT
提出日時 2017-12-31 12:45:04
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 11,536 KB
実行使用メモリ 15,396 KB
最終ジャッジ日時 2023-08-23 12:23:07
合計ジャッジ時間 1,283 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,300 KB
testcase_01 AC 83 ms
15,260 KB
testcase_02 AC 79 ms
15,088 KB
testcase_03 AC 81 ms
15,100 KB
testcase_04 AC 78 ms
15,136 KB
testcase_05 AC 77 ms
15,100 KB
testcase_06 AC 76 ms
15,396 KB
testcase_07 AC 78 ms
15,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

p1 = gets.to_i # 宿泊料金
p2 = gets.to_i # 振替先宿泊料金
n = gets.to_i # 予約件数
sum = 0 #料金合計
roomNumber = Array.new
count = Hash.new(0)

n.times do |i|
    roomNumber[i] = gets.chomp
end

roomNumber.each do |elem|
    count[elem] += 1
end

count.each do |k, v|
    if v > 1
        sum += (v - 1)
    end
end

sum = (p1 + p2) * sum
puts sum
0