結果

問題 No.662 スロットマシーン
ユーザー SSRS
提出日時 2020-11-18 15:09:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 90,572 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 09:02:15
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main(){
	cout << fixed << setprecision(10);
	map<string, int> mp;
	vector<int> c(5);
	for (int i = 0; i < 5; i++){
		string s;
		cin >> s >> c[i];
		mp[s] = i;
	}
	vector<long long> U(5, 5);
	long long m = 1;
	for (int i = 0; i < 3; i++){
		int n;
		cin >> n;
		m *= n;
		vector<int> cnt(5, 0);
		for (int j = 0; j < n; j++){
			string s;
			cin >> s;
			cnt[mp[s]]++;
		}
		for (int j = 0; j < 5; j++){
			U[j] *= cnt[j];
		}
	}
	double E = 0;
	for (int j = 0; j < 5; j++){
		E += c[j] * U[j];
	}
	E /= m;
	cout << E << endl;
	cout << fixed << setprecision(0);
	for (int i = 0; i < 5; i++){
		cout << U[i] << endl;
	}
}
0