結果
| 問題 |
No.662 スロットマシーン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-06 03:34:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 622 bytes |
| コンパイル時間 | 2,476 ms |
| コンパイル使用メモリ | 204,192 KB |
| 最終ジャッジ日時 | 2025-01-10 07:07:58 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | int n; scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
int main(){
map<string,int> id;
int c[5];
rep(i,5){
string s; cin>>s>>c[i];
id[s]=i;
}
vector<int> a[3];
rep(i,3){
int n; scanf("%d",&n);
a[i].resize(n);
rep(j,n){
string s; cin>>s;
a[i][j]=id[s];
}
}
int cnt[3][5]={};
rep(i,3) rep(j,a[i].size()) cnt[i][a[i][j]]++;
double ans1=0;
lint ans2[5];
rep(i,5){
ans2[i]=5;
rep(j,3) ans2[i]*=cnt[j][i];
ans1+=c[i]*ans2[i];
}
rep(i,3) ans1/=a[i].size();
printf("%.9f\n",ans1);
rep(i,5) printf("%lld\n",ans2[i]);
return 0;
}