Bad Luck Island-CodeForce(dp)】的更多相关文章

D. Bad Luck Island Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/problem/D Description The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random i…
传送门 解题思路 比较容易的一道期望\(dp\),设\(f[i][j][k]\)表示石头\(i\)个,剪刀\(j\)个,步子\(l\)个.然后转移的时候用组合数算一下就好了. 代码 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; const int MAXN = 105; int r,s,p; double f[MAXN][M…
题意:会出石头.剪刀.布的人分别有r,s,p个,他们相互碰到的概率相同,输的人死掉,问最终活下去的人是三种类型的概率 设状态dp(i,j,k)为还有i个石头,j个剪刀,k个布时的概率,dp(r,s,p)=1.0 状态转移方程: d(i-1,j,k)+=d(i,j,k)*(i*k)/(i*j+i*k+j*k); d(i,j-1,k)+=d(i,j,k)*(i*j)/(i*j+i*k+j*k); d(i,j,k-1)+=d(i,j,k)*(j*k)/(i*j+i*k+j*k); 因为状态dp(i,j…
题意 岛上有三个物种:剪刀$s$.石头$r$.布$p$ 其中剪刀能干掉布,布能干掉石头,石头能干掉剪刀 每天会从这三个物种中发生一场战争(也就是说其中的一个会被干掉) 问最后仅有$s/r/p$物种生存的概率 Sol 还是想复杂了啊,我列的状态时$f[i][j], g[i][j],t[i][j]$分别表示第$i$天,$j$个$s, r, p$活着的概率 然而转移了一下午也没转移出来.. 标算比我简单的多,直接设$f[i][j][k]$表示剩下$i$个$s$,$j$个$r$,$k$个$p$的概率 然…
D. Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two…
D:Bad Luck Island 一个岛上有r个石头,s个剪子,p个布,他们之间随机挑出两个相遇,如果不是相同物种,就会有一个消失,分别求出最后这座岛上只剩下一个物种的概率. 我们用dp[i][j][k]来存储剩下 i 个石头, j 个剪刀,k 个布时的概率,共dp三次: 如果石头与剪刀碰面,概率是 p1 = i*j / (i*j+j*k+k*i),这种情况下,剪刀会被石头吃掉,所以石头的数目减少1,表现出来是dp[i-1][j][k] = p1*dp[i][j][k]  (dp的3的返回值均…
Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two ra…
题目描述: Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time…
D. Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two…
题目链接:https://vjudge.net/contest/226823#problem/D The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably), and i…