結果

問題 No.662 スロットマシーン
ユーザー かぼちゃかぼちゃ
提出日時 2018-03-09 23:03:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 66,356 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 17:58:17
合計ジャッジ時間 1,272 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    
    vector<string> str(5);
    vector<int> coin(5);
    vector<long long> u(5,5);
    long long ns = 1;
    
    for(int i = 0;i < 5;i++){
        cin >> str[i] >> coin[i];
    }
    
    for(int t = 0;t < 3;t++){
        int n;
        cin >> n;
        ns *= n;
        string a;
        vector<long long> st(5);
        for(int i = 0;i < n;i++){
            cin >> a;
            for(int j = 0;j < 5;j++) if(a == str[j])st[j]++;
        }
        for(int j = 0;j < 5;j++) u[j] *= st[j];
    }
    double ans = 0;
    for(int j = 0;j < 5;j++) ans += coin[j]*u[j];
    ans /= ns;
    cout << ans << endl;
    for(int j = 0;j < 5;j++) cout << u[j] << endl;
    
    return 0;
}

0