結果

問題 No.662 スロットマシーン
ユーザー jiang0503jiang0503
提出日時 2018-03-21 22:26:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,501 bytes
コンパイル時間 1,422 ms
コンパイル使用メモリ 77,952 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 01:05:16
合計ジャッジ時間 3,170 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;

int checkPic(string tmp, vector<string> coinNameArray);


int main() {

    double expectValue = 0;
    double tmpExpect;
    int coin;
    string coinName;
    vector<string> coinNameArray(5);
    vector<int> coinNumber(5);
    int n;
    string tmpPic;
    vector<vector<string>> leel;
    vector<vector<int>> picNumber(3, vector<int>(5));
    leel.resize(3);
    int matchPattern[5];

    for(int i=0; i<5; i++)
    {
        cin>>coinName>>coin;
        coinNameArray[i] = coinName;
        coinNumber[i]=coin;
    }

    for (int i = 0; i < 3; i++)
    {
        cin >> n;
        leel[i].resize(n);
        for (int j = 0; j < n; j++)
        {
            cin >> tmpPic;
            picNumber[i][checkPic(tmpPic, coinNameArray)]+=1;
            leel[i][j]=tmpPic;
        }
    }

    for(int i=0; i<5; i++)
    {
        tmpExpect= (((double)picNumber[0][i]*(double)picNumber[1][i]*(double)picNumber[2][i]*(double)coinNumber[i])*0.00462963);
        expectValue += tmpExpect;
        matchPattern[i] = picNumber[0][i]*picNumber[1][i]*picNumber[2][i]*5;
    }

    expectValue *= 5.0;
    cout<<setprecision(7)<<expectValue<<endl;

    for(int i=0; i<5; i++)
    {
        cout<<matchPattern[i]<<endl;
    }

    return 0;
}

int checkPic(string tmp, vector<string> coinNameArray)
{
    for(int i=0; i<5; i++)
    {
        if(tmp == coinNameArray[i])
            return i;
    }

    return 0;
}
0