hiho week 174 register

Ended

Participants:302

Verdict:Wrong Answer
Score:20 / 100
Submitted:2017-10-29 11:00:53

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <math.h>
int main(){
    int N, M;
    float dp[101][601];
    scanf("%d %d", &N, &M);
    for(int i = 1; i < 7; i++) dp[1][i] = 1/6.0;
    for(int i = 2; i < N; i++) dp[i][i] = pow(1/6.0, i);
    for(int i = 2; i <= N; i++){
        for(int j = i+1; j <= 6*i; j++){
            for(int p = j-1; (p > i) && (p >= j-6); p--)
                dp[i][j] += 1/6.0 * dp[i-1][p];
        }
    }
    printf("%.2f\n", dp[N][M]*100);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX