結果
問題 |
No.662 スロットマシーン
|
ユーザー |
|
提出日時 | 2018-03-09 23:21:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 884 bytes |
コンパイル時間 | 1,003 ms |
コンパイル使用メモリ | 75,968 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 19:27:07 |
合計ジャッジ時間 | 1,624 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <cmath> #include <string> #include <map> #define rep(i, a, n) for(int i = a;i < n;i++) #define repr(i, a, n) for(int i = a;i > n;i--) using namespace std; map<string, int> coin; int n1, n2, n3; map<string, int> cnt[3]; string str[5]; void solve(){ map<string, int> acnt; for(auto s : str){ acnt[s] = 5 * cnt[0][s] * cnt[1][s] * cnt[2][s]; } double e = 0; for(auto s : str){ e += (double)coin[s] * (((((double)acnt[s] / n1) / n2) / n3)); } cout << fixed << e << endl; for(auto s : str) cout << acnt[s] << endl; } int main(){ rep(i, 0, 5){ cin >> str[i]; cin >> coin[str[i]]; } cin >> n1; rep(i, 0, n1){ string s; cin >> s; cnt[0][s]++; } cin >> n2; rep(i, 0, n2){ string s; cin >> s; cnt[1][s]++; } cin >> n3; rep(i, 0, n3){ string s; cin >> s; cnt[2][s]++; } solve(); return 0; }