結果

問題 No.662 スロットマシーン
ユーザー rogi52
提出日時 2022-10-03 21:37:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 743 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 202,780 KB
最終ジャッジ日時 2025-02-07 20:57:18
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    map<string,int> id;
    ll coin[5];
    rep(i,5) {
        string s; cin >> s;
        id[s] = i;
        cin >> coin[i];
    }

    ll n[3];
    ll cnt[3][5] = {};
    rep(i,3) {
        cin >> n[i];
        rep(_,n[i]) {
            string s; cin >> s;
            cnt[i][id[s]]++;
        }
    }

    ll U[5] = {};
    ll a = 0;
    rep(i,5) {
        U[i] = cnt[0][i] * cnt[1][i] * cnt[2][i] * 5;
        a += coin[i] * U[i];
    }

    cout << fixed << setprecision(20) << (long double)a / (n[0] * n[1] * n[2]) << endl;
    rep(i,5) cout << U[i] << endl;
}
0