zoukankan      html  css  js  c++  java
  • CF540D Bad Luck Island

    // Problem: CF540D Bad Luck Island
    // Contest: Luogu
    // URL: https://www.luogu.com.cn/problem/CF540D
    // Memory Limit: 250 MB
    // Time Limit: 2000 ms
    // Author:Cutele
    // 
    // Powered by CP Editor (https://cpeditor.org)
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair<ll, ll>PLL;
    typedef pair<int, int>PII;
    typedef pair<double, double>PDD;
    #define I_int ll
    inline ll read()
    {
        ll x = 0, f = 1;
        char ch = getchar();
        while(ch < '0' || ch > '9')
        {
            if(ch == '-')f = -1;
            ch = getchar();
        }
        while(ch >= '0' && ch <= '9')
        {
            x = x * 10 + ch - '0';
            ch = getchar();
        }
        return x * f;
    }
      
    inline void out(ll x){
        if (x < 0) x = ~x + 1, putchar('-');
        if (x > 9) out(x / 10);
        putchar(x % 10 + '0');
    }
      
    inline void write(ll x){
        if (x < 0) x = ~x + 1, putchar('-');
        if (x > 9) write(x / 10);
        putchar(x % 10 + '0');
    }
      
    #define read read()
    #define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
    #define multiCase int T;cin>>T;for(int t=1;t<=T;t++)
    #define rep(i,a,b) for(int i=(a);i<=(b);i++)
    #define repp(i,a,b) for(int i=(a);i<(b);i++)
    #define per(i,a,b) for(int i=(a);i>=(b);i--)
    #define perr(i,a,b) for(int i=(a);i>(b);i--)
    ll ksm(ll a, ll b,ll p)
    {
        ll res = 1;
        while(b)
        {
            if(b & 1)res = res * a%p;
            a = a * a %p;
            b >>= 1;
        }
        return res;
    }
    
    double dp[110][110][110];
    int r,s,p;
    
    int main(){
    	r=read,s=read,p=read;
    	dp[r][s][p]=1.0;
    	for(int i=r;i>=0;i--)
    		for(int j=s;j>=0;j--)
    			for(int k=p;k>=0;k--){
    				int sum=i*j+i*k+j*k;
    				if(i&&j) dp[i][j-1][k]+=dp[i][j][k]*i*j*1.0/sum;
    				if(i&&k) dp[i-1][j][k]+=dp[i][j][k]*i*k*1.0/sum;
    				if(j&&k) dp[i][j][k-1]+=dp[i][j][k]*j*k*1.0/sum;
    			}
    	double sumr=0,sums=0,sump=0;
    	rep(i,0,r) sumr+=dp[i][0][0];
    	rep(i,0,s) sums+=dp[0][i][0];
    	rep(i,0,p) sump+=dp[0][0][i];
    	printf("%.9f %.9f %.9f
    ",sumr,sums,sump);
    	return 0;
    }
    
    
    
  • 相关阅读:
    iOS小技巧总结,绝对有你想要的
    Myeclipse for Mac快捷键
    iOS开发如何学习前端
    iOS应用支持IPV6,就那点事儿
    App Store审核被拒的23个理由
    43个优秀的Swift开源项目
    ExtJs组件之间的相互访问,访问机制
    hibernate or连接查询内容/criteria动态或连接查询/disjunction/其他查询条件
    hibernate如何解除关系———只删除多方保留一方
    java如何操作视图
  • 原文地址:https://www.cnblogs.com/OvOq/p/15108634.html
Copyright © 2011-2022 走看看