首页 > 其他 > 详细

东方CannonBall

时间:2020-02-22 19:07:36      阅读:63      评论:0      收藏:0      [点我收藏+]

代码

#include<cstdio>
using namespace std;

const int N = 1e5;
double fx[N + 5] , fy[N + 5] , g[N + 5];
int x , y;

inline void getp(int n , double f[] , double g[])
{
    for(register int i = 1; i <= n; i++)
    {
        for(register int j = 0; j <= 6 * i; j++)
        {
            g[j] = 0;
            for(register int k = j - 1; k >= j - 6 && k >= 0; k--) g[j] += f[k] / 6;
        }
        for(register int j = 0; j <= 6 * i; j++) f[j] = g[j];
    }
}

int main()
{
    scanf("%d" , &x) , scanf("%d" , &y);
    fx[0] = fy[0] = 1;
    getp(x , fx , g);
    getp(y , fy , g);
    double ans = 0 , sum = 0;
    for(register int i = 1; i <= x * 6; i++) ans += fx[i] * sum , sum += fy[i];
    printf("%.2lf%%\n" , ans * 100);
}

东方CannonBall

原文:https://www.cnblogs.com/leiyuanze/p/12346533.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!