# ZOJ 3329 【概率DP】

dp[i]=dp[i+x]*(k1*k2*k3);(x=i+j+k)（i=1...k1  j=1...k2  k=1...k3）

shit

```#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
double dp1[1000],dp2[1000];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,aa,bb,cc,a,b,c;
scanf("%d%d%d%d%d%d%d",&n,&aa,&bb,&cc,&a,&b,&c);
memset(dp1,0,sizeof(dp1));
memset(dp2,0,sizeof(dp2));
for(int w=n; w>=0; w--)
{
for(int i=1; i<=aa; i++)
{
for(int j=1; j<=bb; j++)
{
for(int k=1; k<=cc; k++)
{
if(i==a&&j==b&&k==c)
{
dp2[w]+=1.0/(aa*bb*cc);
}
else
{
dp2[w]+=dp2[w+i+j+k]/(aa*bb*cc);
dp1[w]+=dp1[w+i+j+k]/(aa*bb*cc);
}
}
}
}
dp1[w]+=1;
}
printf("%.15lf\n",dp1[0]/(1-dp2[0]));
}
}```

## zoj 3822概率dp

Domination Time Limit: 8 Seconds Memory Limit: 131072 KB Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboard with N r

## zoj 3822 概率dp

1 /* 2 题目大意:一个n*m的棋盘,每天放一个棋子,每行每列至少有一个棋子时结束.求达到每行每列至少有一个棋子的天数的数学期望. 3 */ 4 #include <iostream> 5 #include <cstdio> 6 #include <cstring> 7 using namespace std; 8 9 const int maxn=55; 10 double dp[maxn*maxn][maxn][maxn];//放i颗棋子,j行有棋子,k列有棋子

## zoj 3735 概率dp

Josephina and RPG Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge A role-playing game (RPG and sometimes roleplaying game) is a game in which players assume the roles of characters in a fictional setting. Players take responsibil

## ZOJ 3551 Bloodsucker （概率DP）

ZOJ Problem Set - 3551 Bloodsucker Time Limit: 2 Seconds      Memory Limit: 65536 KB In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them meet. Nothing will happen if they are of the same species, that is, a people

## zoj 3822 Domination 【概率DP 求期望】

Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboar

## zoj 3288 Domination (概率dp)

///dp[i][j][k]表示i行j列已经有棋子,且放了k个的概率 ///dp[i][j][k]一共有四种转移方式 ///1:dp[i-1][j][k-1] 概率为 (n-(i-1))*j/(n*m-(k-1)) ///2:dp[i][j-1][k-1] 概率为 i*(m-(j-1))/(n*m-(k-1)) ///3:dp[i-1][j-1][k-1] 概率为 (n-(i-1))*(m-(j-1))/(n*m-(k-1)) ///4:dp[i][j][k-1] 概率为 (i*j-(k-1))