hiho week 174 register

Ended

Participants:302

Verdict:Accepted
Score:100 / 100
Submitted:2017-10-31 00:37:50

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// ybmj
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const int maxn = 105;
double dp[maxn][605];
int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
    freopen("1.out","w",stdout);
    #endif
    */
    std::ios::sync_with_stdio(false);
    int n, m;
    while (cin >> n >> m) {
        memset(dp, 0, sizeof(dp));
        for (int i = 1; i <= 6; i++) dp[1][i] = 1.0 / 6;
        for (int i = 2; i <= n; i++) {
            for (int t = 1; t <= 6; t++) {
                for (int k = 1; k + t <= m; k++) {
                    dp[i][k + t] += dp[i - 1][k] * 1.0 / 6;
                }
            }
        }
        cout << fixed << setprecision(2) << dp[n][m] * 100 << endl;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX