結果

問題 No.662 スロットマシーン
ユーザー bpidtr6twgqbpidtr6twgq
提出日時 2018-03-09 23:38:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 5,829 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 109,072 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-01 03:58:20
合計ジャッジ時間 2,158 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #



//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <tuple> 
using namespace std;
typedef long long ll;

//input
//------------------------------------------
#define re(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define rv_row(type, n, ...)vector<type> __VA_ARGS__;MACRO_VEC_ROW_Init(n, __VA_ARGS__); for(int i=0; i<n; ++i){MACRO_VEC_ROW_Scan(i, __VA_ARGS__);}
template<typename T> void MACRO_VEC_ROW_Init(int n, T& t) { t.resize(n); }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Init(int n, First& first, Rest&...rest) { first.resize(n); MACRO_VEC_ROW_Init(n, rest...); }
template<typename T> void MACRO_VEC_ROW_Scan(int p, T& t) { cin >> t[p]; }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Scan(int p, First& first, Rest&...rest) { cin >> first[p]; MACRO_VEC_ROW_Scan(p, rest...); }
#define rv(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define rMAT(type, c, n, m) vector<vector<type>> c(n, vector<type>(m));for(auto& r:c)for(auto& i:r)cin>>i;  
void _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
// output
//------------------------------------------
#define pr(x) cout<<x<<endl;
#define prv(v){for(const auto& xxx : v){cout << xxx << " ";}cout << "\n";}
#define sankou(x,a,b) cout<<(x?a:b)<<endl;
#define hihumi(x,a,y,b,c) cout<<(x?a:y?b:c)<<endl;
#define YESNO(x) cout<<(x?"YES":"NO")<<endl;
#define yesno(x) cout<<(x?"Yes":"No")<<endl;
#define ck(x)  cerr << #x << " = " << (x) << endl;
#define ckv(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
//conversion
//------------------------------------------
inline ll toInt(std::string s) { ll v; std::istringstream sin(s);sin >> v;return v; }
template<class T> inline string toString(T x) { ostringstream sout;sout << x;return sout.str(); }
//math
//------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }
template<typename A, typename B>inline void chmin(A &a, B b) { if (a>b)a = b; }
template<typename A, typename B>inline void chmax(A &a, B b) { if (a<b)a = b; }
ll qp(ll a, ll b) { ll ans = 1ll;do { if (b & 1)ans = 1ll * ans*a;a = 1ll * a*a; } while (b >>= 1);return ans; }
ll qpmod(ll a, ll b, ll mo) { ll ans = 1ll;do { if (b & 1)ans = 1ll * ans*a%mo;a = 1ll * a*a%mo; } while (b >>= 1);return ans; }
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline bool valid(int x, int h) { return 0 <= x && x < h; }
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTST(s,c) (((s).find(c)) != std::string::npos)
#define SORT(c) sort((c).begin(),(c).end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,val) (lower_bound(x.begin(),x.end(),val)-x.begin())
#define POSU(x,val) (upper_bound(x.begin(),x.end(),val)-x.begin())
#define X first
#define Y second
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMINF(a) memset(a,0x3f,sizeof(a))//1e9<1061109567<INTMAX/2
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define FORll(i,a,b) for(long long i=(a);i<(b);++i)
#define repll(i,n) FORll(i,0,n)
#define rrep(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define rrepll(i,a,b) for(long long i=(b)-1ll;i>=a;i--)
#define fo(x,c) for(auto &x : c)

#define repeat(i,a,b) for(int i=(a);i<=(b);++i)
//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef pair<pair<int, int>, int> PT;
typedef vector<pair<int, int>> vpii;
//constant
//------------------------------------------
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int INF = (int)(1e9) + 7;
const ll MOD = (ll)(1e9) + 7;
const ll MOD2 = (ll)(1e18) + 9;
#define ADD(a, b) a = (a + ll(b)) % MOD
#define MUL(a, b) a = (a * ll(b)) % MOD
const ll INF2 = (ll)(1e18);
const ll INTMAX = (0x7FFFFFFFL);
const ll LLMAX = (0x7FFFFFFFFFFFFFFFL);
const int N4 = (int)1e4 + 10;
const int N5 = (int)1e5 + 10;
const int N9 = (int)1e9;
int dx[8] = { 1, 0, -1, 0 , 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, -1, -1,  1, 1 };
//------------------------------------------

ll ans, cnt, ret, cur, sum, f;

ll n[3];

void _main() {
    map<string, ll> ma;
    vs ss(5);
    vll cc(5);
    rep(i, 5) {
        cin >> ss[i] >> cc[i];
        ma[ss[i]] = cc[i];
    }
    vector<map<string, ll>> v(3);

    rep(i, 3) {
        cin >> n[i];
        rv(string, u, n[i]);
        fo(x, u)v[i][x]++;
    }
    vll answer(5);
    rep(i, 5) {
        answer[i] = 5;
        rep(j, 3)answer[i] *= v[j][ss[i]];

    }
    double d = 0.0;
    rep(i, 5) {
        d += double(answer[i] * cc[i]) / double(n[0] * n[1] * n[2]);
    }
    cout << d << endl;
    rep(i, 5)cout << answer[i] << endl;
}

0