結果

問題 No.662 スロットマシーン
ユーザー hkrhkr
提出日時 2018-03-09 23:28:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 168,416 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 03:15:21
合計ジャッジ時間 2,134 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<string> coin_name(5);
  vector<int> coin_num(5);
  for(int i=0;i<5;i++) {
    cin >> coin_name[i] >> coin_num[i];
  }

  vector< vector<ll> > riru_cnt(3, vector<ll>(5, 0));
  vector<string> riru[3];
  ll tot = 1;
  for(int i=0;i<3;i++) {
    int ni;
    cin >> ni;
    tot *= ni;
    for(int j=0;j<ni;j++) {
      string s;
      cin >> s;
      riru[i].push_back(s);
      for(int k=0;k<5;k++) {
        if(coin_name[k] == s)
          riru_cnt[i][k]++;
      }
    }
  }



  vector<ll> ans(5, 0);
  ll tot_hit = 0;
  for(int i=0;i<5;i++) {
    ll x = 1;
    for(int j=0;j<3;j++) {
      x *= riru_cnt[j][i];
    }
    ans[i] = x*5;
    tot_hit += ans[i] * coin_num[i];
  }

  cout << (double) tot_hit / tot << endl;
  for(int i=0;i<5;i++)
    cout << ans[i] << endl;

}
0