結果
問題 | No.586 ダブルブッキング |
ユーザー |
![]() |
提出日時 | 2019-02-21 22:44:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 1,347 ms |
コンパイル使用メモリ | 157,712 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 10:39:56 |
合計ジャッジ時間 | 1,698 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) int gcd(int a,int b){return b?gcd(b,a%b):a;} int main() { cin.tie(0); ios::sync_with_stdio(false); int p[2],n,r[100],a,m=0,c=0; bool f; cin >> p[0] >> p[1]; cin >> n; rep(i,n) { cin >> a; f=false; rep(j,m) { if(a==r[j]) { c++; f=true; break; } } if(!f) { r[m++]=a; } } cout << c*(p[0]+p[1]) << endl; return 0; }