hiho week 174 register

Ended

Participants:302

Verdict:Accepted
Score:100 / 100
Submitted:2017-11-01 10:16:45

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
//
//  main.cpp
//  Dice Possibility
//
//  Created by Jiao Liu on 11/1/17.
//  Copyright © 2017 ChangHong. All rights reserved.
//
#include <iostream>
#include <iomanip>
using namespace std;
float dice[105][605];
float subPro(int i, int j)
{
    float sum = 0;
    for (int x = 1; x <= 6; x++) {
        if (j-x >= i-1 && j-x <= 6*(i-1)) {
            sum += dice[i-1][j-x]*dice[1][x];
        }
    }
    return sum;
}
int main(int argc, const char * argv[]) {
    for (int i = 1; i <= 6; i++) {
        dice[1][i] = 1.0/6;
    }
    for (int i = 2; i <= 100; i++) {
        for (int j = i; j <= 6*i; j++) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX