东方CannonBall

代码

#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);
}

猜你喜欢

转载自www.cnblogs.com/leiyuanze/p/12346533.html
今日推荐