結果

問題 No.662 スロットマシーン
ユーザー pirozhkipirozhki
提出日時 2018-06-04 23:53:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 640 ms
コンパイル使用メモリ 78,732 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 22:19:30
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,384 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 5 ms
4,380 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 4 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0