結果
| 問題 | No.586 ダブルブッキング | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-02-09 22:39:36 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 555 bytes | 
| コンパイル時間 | 656 ms | 
| コンパイル使用メモリ | 60,852 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-08 16:21:30 | 
| 合計ジャッジ時間 | 1,376 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
ソースコード
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main(void)
{
    int p1, p2, n;
    cin >> p1 >> p2 >> n;
    int r[n];
    int c = 0;
    for(int i = 0; i < n; i++)
        cin >> r[i];
    
    for(int i = 0; i < n-1; i++)
        for(int j = i+1; j < n; j++)
        {
            if(r[i]==0)
                break;
            if(r[i]==r[j])
            {
                c++;
                r[j] = 0;
            }
        }
    cout << c*(p1+p2);
    return 0;
}
            
            
            
        