結果
| 問題 | No.662 スロットマシーン | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-06-04 23:53:03 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 851 bytes | 
| コンパイル時間 | 714 ms | 
| コンパイル使用メモリ | 77,704 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-30 09:49:45 | 
| 合計ジャッジ時間 | 1,441 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <map>
#include <string>
using namespace std;
const int N = 5;
int main() {
	array<uint64_t, N> cs, bs{5, 5, 5, 5, 5};
	vector<int> rs[3];
	map<string, int> m;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s >> cs[i];
		m[s] = i;
	}
	double n[3];
	for (int i = 0; i < 3; i++) {
		cin >> n[i];
		for (int j = 0; j < n[i]; j++) {
			string s;
			cin >> s;
			rs[i].emplace_back(m[s]);
		}
	}
	for (int i = 0; i < 5; i++) {
		int n[3];
		for (int j = 0; j < 3; j++){
			n[j] = count(rs[j].begin(), rs[j].end(), i);
		}
		for(const int& m : n){
			bs[i] *= m;
		};
	}
	double exp = 0;
	for (int i = 0; i < N; i++) {
		exp += cs[i] / n[0] * bs[i] / n[1];
	}
	exp /= n[2];
	cout << exp << endl;
	for (uint64_t i : bs) {
		cout << i << endl;
	}
	return 0;
}
            
            
            
        