結果

問題 No.662 スロットマシーン
コンテスト
ユーザー masa
提出日時 2018-03-09 23:18:08
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 884 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,028 ms
コンパイル使用メモリ 105,220 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-26 22:18:02
合計ジャッジ時間 5,139 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <numeric>

using namespace std;

int main() {
	map<string, int> pic2idx;
	vector<int> coin(5);
	string s;
	for (int i = 0; i < 5; i++) {
		cin >> s >> coin[i];
		pic2idx[s] = i;
	}


	vector<vector<int>> reel(3, vector<int>(5, 0));
	vector<int> ns(3);
	for (int i = 0; i < 3; i++) {
		cin >> ns[i];
		for (int j = 0; j < ns[i]; j++) {
			cin >> s;

			if (pic2idx.count(s) > 0) {
				reel[i][pic2idx[s]]++;
			}
		}
	}

	vector<long long> U(5, 0);
	long long prize = 0;
	for (int i = 0; i < 5; i++) {
		U[i] = 5LL * reel[0][i] * reel[1][i] * reel[2][i];
		prize += U[i] * coin[i];
	}
	long long total = 1LL * ns[0] * ns[1] * ns[2];
	double exp = 1.0 * prize / total;

	cout << exp << endl;
	for (auto x: U) {
		cout << x << endl;
	}
	return 0;
}
0