結果

問題 No.586 ダブルブッキング
ユーザー kurenai3110
提出日時 2017-11-03 22:23:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 59,100 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 15:51:58
合計ジャッジ時間 954 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int A[1000];

int main()
{
	int P1, P2; cin >> P1 >> P2;
	int N; cin >> N;
	
	for (int i = 0; i < N; i++) {
		int r; cin >> r;
		A[r]++;
	}

	int ans = 0;
	for (int i = 0; i < 1000; i++) {
		if(A[i])ans += (A[i] - 1)*(P1 + P2);
	}
	cout << ans << endl;

    return 0;
}

0