結果

問題 No.662 スロットマシーン
ユーザー 👑 nu50218nu50218
提出日時 2019-09-11 19:30:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 998 bytes
コンパイル時間 1,802 ms
コンパイル使用メモリ 172,972 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 13:53:47
合計ジャッジ時間 3,052 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    unordered_map<string, int> index;
    int coin[5];
    for (size_t i = 0; i < 5; i++) {
        string str;
        cin >> str >> coin[i];
        index[str] = i;
    }
    long long n1, n2, n3;
    long long cnt1[5] = {}, cnt2[5] = {}, cnt3[5] = {};
    cin >> n1;
    for (size_t i = 0; i < n1; i++) {
        string A;
        cin >> A;
        cnt1[index[A]] += 1;
    }
    cin >> n2;
    for (size_t i = 0; i < n2; i++) {
        string A;
        cin >> A;
        cnt2[index[A]] += 1;
    }
    cin >> n3;
    for (size_t i = 0; i < n3; i++) {
        string A;
        cin >> A;
        cnt3[index[A]] += 1;
    }
    long double a = 0.0L;
    for (size_t i = 0; i < 5; i++) {
        a += 5 * coin[i] * cnt1[i] * cnt2[i] * cnt3[i];
    }
    a /= (long double)n1 * (long double)n2 * (long double)n3;
    cout << a << endl;
    for (size_t i = 0; i < 5; i++) {
        cout << 5 * cnt1[i] * cnt2[i] * cnt3[i] << endl;
    }
}
0