結果

問題 No.586 ダブルブッキング
ユーザー toshiro_yanagi
提出日時 2018-06-06 20:30:19
言語 Nim
(2.2.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 379 bytes
コンパイル時間 3,606 ms
コンパイル使用メモリ 70,240 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 10:21:00
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 2 RE * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, tables
proc getInt: int = stdin.readLine.parseInt

# Yuki/振替先ホテルの料金, 予約の件数
let P1, P2, N = getInt()

var
  R = initCountTable[int]()   #予約された部屋番号
  cost = 0

for n in 0 ..< N: R.inc getInt()

while R.largest.val > 1:
  let maxR = R.largest
  cost += (P1 + P2) * (maxR.val - 1)
  R[maxR.key] = 0

echo cost
0