. - 力扣(LeetCode)
class Solution {
public:
vector<double> statisticsProbability(int num) {
vector<double> dp(6, 1.0 / 6.0);
for (int i = 2; i <= num; i++) {
vector<double> tmp(5 * i + 1, 0);
for (int j = 0; j < dp.size(); j++) {
for (int k = 0; k < 6; k++) {
tmp[j + k] += dp[j] / 6.0;
}
}
dp = tmp;
}
return dp;
}
};