結果
問題 | No.662 スロットマシーン |
ユーザー |
|
提出日時 | 2018-03-09 22:59:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 1,279 bytes |
コンパイル時間 | 1,447 ms |
コンパイル使用メモリ | 117,312 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 11:12:16 |
合計ジャッジ時間 | 2,111 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#define _USE_MATH_DEFINES#include <cstdio>#include <iostream>#include <sstream>#include <fstream>#include <iomanip>#include <algorithm>#include <cmath>#include <complex>#include <string>#include <vector>#include <list>#include <queue>#include <stack>#include <set>#include <map>#include <bitset>#include <numeric>#include <limits>#include <climits>#include <cfloat>#include <functional>#include <iterator>using namespace std;int main(){const int n = 5;map<string, int> index;vector<int> coin(n);for(int i=0; i<n; ++i){string s;cin >> s >> coin[i];index[s] = i;}vector<int> m(3);vector<vector<int> > cnt(3, vector<int>(n, 0));for(int i=0; i<3; ++i){cin >> m[i];for(int j=0; j<m[i]; ++j){string s;cin >> s;int k = index[s];++ cnt[i][k];}}long long sum = 0;vector<long long> ans(n, 5);for(int i=0; i<n; ++i){for(int j=0; j<3; ++j)ans[i] *= cnt[j][i];sum += ans[i] * coin[i];}double ave = sum;for(int i=0; i<3; ++i)ave /= m[i];printf("%.10f\n", ave);for(int i=0; i<n; ++i)cout << ans[i] << endl;return 0;}