結果

問題 No.662 スロットマシーン
ユーザー dustnn0dustnn0
提出日時 2018-03-10 00:59:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 839 bytes
コンパイル時間 1,851 ms
コンパイル使用メモリ 176,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 07:50:06
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 4 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 4 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  vector<pair<string,int>> value(5);
  rep(i,5) cin>>value[i].first>>value[i].second;
  vector<map<string,int>> v(3);
  rep(i,3) rep(j,5){
    string name=value[j].first;
    v[i].insert(make_pair(name,0));
  }
  int n[3];
  rep(i,3){
    cin>>n[i];
    rep(j,n[i]){
      string s; cin>>s;
      v[i][s]++;
    }
  }
  ll num[5];
  rep(i,5){
    string name=value[i].first;
    ll tmp=5;
    rep(j,3){
      tmp*=1LL*v[j][name];
    }
    num[i]=tmp;
  }
  ll total=1;
  rep(i,3) total*=n[i];
  double ans=0.0;
  rep(i,5){
    ans+=value[i].second*num[i]/(total*1.0);
  }
  cout<<setprecision(10);
  cout<<ans<<endl;
  rep(i,5) cout<<num[i]<<endl;
  return 0;
}
0