結果
問題 | No.586 ダブルブッキング |
ユーザー |
|
提出日時 | 2017-11-03 22:21:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 1,302 ms |
コンパイル使用メモリ | 157,456 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 15:50:26 |
合計ジャッジ時間 | 1,825 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d%d",&p1,&p2); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&a); | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define MOD 1000000007LLusing namespace std;typedef long long ll;typedef pair<int,int> P;int p1,p2;int n;int flag[1001];int main(void){scanf("%d%d",&p1,&p2);int ans=0;scanf("%d",&n);for(int i=0;i<n;i++){int a;scanf("%d",&a);if(flag[a]>=1){ans+=p1+p2;}flag[a]++;}printf("%d\n",ans);return 0;}