結果

問題 No.662 スロットマシーン
ユーザー pirozhkipirozhki
提出日時 2018-06-04 23:46:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 841 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 78,312 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-12 22:18:53
合計ジャッジ時間 1,662 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <map>
#include <string>

using namespace std;

const int N = 5;

int main() {
	array<int, 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 (int i : bs) {
		cout << i << endl;
	}

	return 0;
}
0