CF 540D Bad Luck Island
一看就是DP题(很水的一道紫题)
设\(dp[i][j][k]\)为留下\(i\)个\(r\)族的人,死去\(j\)个\(s\)族的人,死去\(k\)个\(p\)族的人的概率(跟其他的题解有点差别,但本质相同)。
#include <bits/stdc++.h>
using namespace std;
double dp[101][101][101];
int a, b, c;
int main() {
scanf("%d%d%d", &a, &b, &c);
for (int i = 1; i <= 100; i++)
for (int j = 1; j <= 100; j++) {
dp[i][j][0] = 1;
for (int k = 1; k <= 100; k++)
dp[i][j][k] += (i * j * dp[i][j - 1][k] + j * k * dp[i][j][k - 1] + k * i * dp[i - 1][j][k]) / (i * j + j * k + k * i);
}
printf("%.12lf %.12lf %.12lf\n", dp[a][b][c], dp[b][c][a], dp[c][a][b]);
return 0;
}
CF 540D Bad Luck Island的更多相关文章
- CF 540D——Bad Luck Island——————【概率dp】
Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- CodeForces - 540D Bad Luck Island —— 求概率
题目链接:https://vjudge.net/contest/226823#problem/D The Bad Luck Island is inhabited by three kinds of ...
- Codeforces 540D Bad Luck Island - 概率+记忆化搜索
[题意] 一个岛上有三种生物A,B,C,各有多少只在输入中会告诉你,每种最多100只 A与B碰面,A会吃掉B, B与C碰面,B会吃掉C, C与A碰面,C会吃掉A...忍不住想吐槽这种环形食物链 碰面是 ...
- Codeforces 540D Bad Luck Island
http://codeforces.com/problemset/problem/540/D 题目大意: 会出石头.剪刀.布的人分别有r,s,p个,他们相互碰到的概率相同,输的人死掉,问最终活下去的人 ...
- CodeForces 540D Bad Luck Island (DP)
题意:一个岛上有石头,剪刀和布,规则就不用说了,问你最后只剩下每一种的概率是多少. 析:很明显的一个概率DP,用d[i][j][k]表示,石头剩下 i 个,剪刀剩下 j 个,布剩下 k 个,d[r][ ...
- 540D - Bad Luck Island(概率DP)
原题链接:http://codeforces.com/problemset/problem/540/D 题意:给你石头.剪刀.布的数量,它们之间的石头能干掉剪刀,剪刀能干掉布,布能干掉石头,问最后石头 ...
- codeforces 540D Bad Luck Island (概率DP)
题意:会出石头.剪刀.布的人分别有r,s,p个,他们相互碰到的概率相同,输的人死掉,问最终活下去的人是三种类型的概率 设状态dp(i,j,k)为还有i个石头,j个剪刀,k个布时的概率,dp(r,s,p ...
- cf.301.D. Bad Luck Island(dp + probabilities)
D. Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- CF#301 D:Bad Luck Island (概率dp)
D:Bad Luck Island 一个岛上有r个石头,s个剪子,p个布,他们之间随机挑出两个相遇,如果不是相同物种,就会有一个消失,分别求出最后这座岛上只剩下一个物种的概率. 我们用dp[i][j] ...
随机推荐
- hdu 3486
题意:n个人,每个人的价格a[ i ] ,求最少分几组,每组取一个人,多出来的人就不考虑,使得这取出人的价格大于k.(每组人数一样) 分析:每组取一个人,那这个人肯定是这组最大的,枚举多少组就可以 ...
- 第八篇 编写spider爬取jobbole的所有文章
通过scrapy的Request和parse,我们能很容易的爬取所有列表页的文章信息. PS:parse.urljoin(response.url,post_url)的方法有个好处,如果post_ur ...
- python--常用模块:collections 、time、random
一.collections 模块 1:nametuple 生成可以用名字访问内容的元祖 from collections import namedtuple point=namedtuple('p ...
- css切角效果,折角效果
html <div class="one">12345</div> <div class="two">abcde</d ...
- C# ASCII码和英文字母相互转换和ASCII码对照表
1.字母转换成ASCII码 string str = "hello"; ]; array = System.Text.Encoding.ASCII.GetBytes(str); / ...
- C# 简单的统计指定几个字符组合的所有结果
比如 用 a,b,c,d 4个字符组成一个8个长度的字符串,问一共有多少可能,应该有4的8次方种,用代码简单实现 private string[] AAA() { string[] cs = { &q ...
- vue之父子组件执行对方的方法
一.子组件执行父组件中的方法 1.父组件将方法名传给子组件,子组件进行调用 父组件中: <Vbutton typeBtn="success" :btnUserMethod=& ...
- 区别 |mysql |Timestamp、time、datetime
Timestamp 时间格式为 类似 2012-11-11 12:23:00 ,默认值为当前时间 time 时间格式类似12:23:00 默认值为null datetime 时间格式类似2012-11 ...
- fastJson中常用方法以及遇到的“坑”
1.使用fastJson,首先引入fastJson依赖 <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> & ...
- NX二次开发-UFUN CSYS坐标系转换UF_CSYS_map_point
1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_curve.h> 5 #include <uf_csys.h> 6 ...