結果

問題 No.662 スロットマシーン
ユーザー AqFvAqFv
提出日時 2018-03-09 23:08:11
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 877 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 76,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 18:07:30
合計ジャッジ時間 1,291 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,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
5,376 KB
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#define rep(i, a, n) for(int i = a;i < n;i++)
#define repr(i, a, n) for(int i = a;i > n;i--)
using namespace std;


map<string, int> coin;
int n1, n2, n3;
map<string, int> cnt[3];
string str[5];


void solve(){
	map<string, int> acnt;
	for(auto s : str){
		acnt[s] = 5 * cnt[0][s] * cnt[1][s] * cnt[2][s];
	}
	double e = 0;
	for(auto s : str){
		double u = n1 * n2 * n3;
		e += coin[s] * ((double)acnt[s] / u);
	}
	cout << e << endl;
	for(auto s : str) cout << acnt[s] << endl;
}


int main(){
	rep(i, 0, 5){
		cin >> str[i];
		cin >> coin[str[i]];
	}
	cin >> n1;
	rep(i, 0, n1){
		string s;
		cin >> s;
		cnt[0][s]++;
	}
	cin >> n2;
	rep(i, 0, n2){
		string s;
		cin >> s;
		cnt[1][s]++;
	}
	cin >> n3;
	rep(i, 0, n3){
		string s;
		cin >> s;
		cnt[2][s]++;
	}

	solve();

	return 0;
}
0