結果
| 問題 |
No.662 スロットマシーン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-21 23:38:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,263 bytes |
| コンパイル時間 | 1,208 ms |
| コンパイル使用メモリ | 81,060 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 19:44:22 |
| 合計ジャッジ時間 | 2,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <iomanip>
using namespace std;
int main() {
double expectValue = 0;
unsigned int coin;
string coinName;
vector<unsigned int> coinNumber(5);
map<string, int> coinMap;
unsigned int n[3];
string tmpPic;
vector<vector<unsigned int>> picNumber(3, vector<unsigned int>(5));
unsigned long long matchPattern[5]={0, 0, 0, 0, 0};
for(int i=0; i<5; ++i)
{
cin>>coinName>>coin;
coinNumber[i]=coin;
coinMap[coinName] = i;
}
for (int i = 0; i < 3; ++i)
{
cin >> n[i];
for (int j = 0; j < n[i]; ++j)
{
cin >> tmpPic;
picNumber[i][coinMap[tmpPic]]++;
}
}
for(int i=0; i<5; ++i)
{
expectValue += ((picNumber[0][i]/(double)n[0])*(picNumber[1][i]/(double)n[1])*(picNumber[2][i]/(double)n[2])*(double)coinNumber[i]);
matchPattern[i] = (unsigned long long)picNumber[0][i]*(unsigned long long)picNumber[1][i]*(unsigned long long)picNumber[2][i]*(unsigned long long)5;
}
expectValue *= 5.0;
cout<<setprecision(7)<<expectValue<<endl;
for (unsigned long long i : matchPattern)
cout<< i <<endl;
return 0;
}