题目链接: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…
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…
[题意] 一个岛上有三种生物A,B,C,各有多少只在输入中会告诉你,每种最多100只 A与B碰面,A会吃掉B, B与C碰面,B会吃掉C, C与A碰面,C会吃掉A...忍不住想吐槽这种环形食物链 碰面是随机的.到最后岛上只剩下一种生物,问这种生物分别是A,B,C的概率是多少. [题解] 其实很简单,这题,状态方程很好想.. 设dp[i][j][k]为生物A有i只,生物B有j只,生物C有k只的概率情况,显然dp的返回值应该有三个,分别是最后剩下该种生物的概率 那么我们考虑状态转移的情况. 如果A与B…
题意:会出石头.剪刀.布的人分别有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…
http://codeforces.com/problemset/problem/540/D 题目大意: 会出石头.剪刀.布的人分别有r,s,p个,他们相互碰到的概率相同,输的人死掉,问最终活下去的人是三种类型的概率. 思路: f[i][j][k]代表i个石头,j个剪刀,k个布状态的概率,初始f[n][m][K]=1 #include<cstdio> #include<cmath> #include<algorithm> #include<cstring>…
原题链接:http://codeforces.com/problemset/problem/540/D 题意:给你石头.剪刀.布的数量,它们之间的石头能干掉剪刀,剪刀能干掉布,布能干掉石头,问最后石头.剪刀.布各自只有一种存活的概率. 思路:dp[i][j][k]为石头剪刀布分别剩下i,j,k个的概率.以布消灭石头为例,从dp[i][j][k]转移到dp[i-1][j][k]需要dp[i][j][k]乘上转移的概率总情况为tot=i*k+i*j+j*k,石头遇上布的情况为i*k,所以这里的概率为…
题意:一个岛上有石头,剪刀和布,规则就不用说了,问你最后只剩下每一种的概率是多少. 析:很明显的一个概率DP,用d[i][j][k]表示,石头剩下 i 个,剪刀剩下 j 个,布剩下 k 个,d[r][s][p] = 1,那状态转发方程怎么写呢?是这样的 如果石头减少了1,那么肯定是布干的,那么是哪个布干掉了哪个石头呢?这又是另一个问题,答案就是 i * k,那么总数就是 i * k + i * j + j * k. 最后再把各项加起来即可. 代码如下: #include <iostream>…
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的返回值均…