結果
問題 | No.662 スロットマシーン |
ユーザー |
![]() |
提出日時 | 2018-03-09 23:03:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 681 ms |
コンパイル使用メモリ | 65,848 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 11:18:24 |
合計ジャッジ時間 | 1,352 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#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;}