HDU 4870 Rating (2014 Multi-University Training Contest 1)
Rating
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 578 Accepted Submission(s): 363
Special Judge
0.814700
82.181160
看了官方题解表示还未太明白,而听说到更变态的dp
首先将50分积到1000 简化为 1积到20
f[i] 表示 从第 i 分 到 i+1 分 的期望比赛次数
则 f[i] = p + (1-p) * ( 1+ f[i-2] + f[i-1] + f[i] )
f[i] = (1-p) / p * ( f[i-1] + f[i-2] ) + 1/p
其中 易得到 f[0]=1/p f[1]=p+(1-p)*(1+f[0]+f[1]) 得到 f[1]=1/p^2
则可推出
ans[i][j] 表示其中一个赢i分另一个赢j分,已得到两者相差不会超过1分,达到这种分数的期望比赛次数。
所以可以得到相应的递推式
ans[i+1][i]=ans[i][i]+f[i];
ans[i+1][i+1]=ans[i+1][i]+f[i];
#include <iostream>
#include <cstdio>
using namespace std; double p;
double f[],ans[][];
int main()
{
while(scanf("%lf",&p)!=EOF){
f[]=1.0/p;
f[]=f[]/p;
for(int i=; i<; i++)
f[i]=(-p)/p*(f[i-]+f[i-])+1.0/p;
ans[][]=;
for(int i=; i<; i++){
ans[i+][i]=ans[i][i]+f[i];
ans[i+][i+]=ans[i+][i]+f[i];
}
printf("%.6f\n",ans[][]);
}
return ;
}
HDU 4870 Rating (2014 Multi-University Training Contest 1)的更多相关文章
- HDU 4870 Rating (2014 多校联合第一场 J)(概率)
题意: 一个人有两个TC的账号,一开始两个账号rating都是0,然后每次它会选择里面rating较小的一个账号去打比赛,每次比赛有p的概率+1分,有1-p的概率-2分,当然如果本身是<=2分的 ...
- HDU 4870 Rating(概率、期望、推公式) && ZOJ 3415 Zhou Yu
其实zoj 3415不是应该叫Yu Zhou吗...碰到ZOJ 3415之后用了第二个参考网址的方法去求通项,然后这次碰到4870不会搞.参考了chanme的,然后重新把周瑜跟排名都反复推导(不是推倒 ...
- hdu 4870 Rating
题目链接:hdu 4870 这题应该算是概率 dp 吧,刚开始看了好几个博客都一头雾水,总有些细节理不清楚,后来看了 hdu 4870 Rating (概率dp) 这篇博客终于有如醍醐灌顶,就好像是第 ...
- HDU 4870 Rating(高斯消元 )
HDU 4870 Rating 这是前几天多校的题目,高了好久突然听旁边的大神推出来说是可以用高斯消元,一直喊着赶快敲模板,对于从来没有接触过高斯消元的我来说根本就是一头雾水,无赖之下这几天做DP ...
- HDU 4870 Rating 概率DP
Rating Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 4930 Fighting the Landlords--2014 Multi-University Training Contest 6
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS ...
- hdu 4870 Rating(可能性DP&高数消除)
Rating Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- hdu 4870 rating(高斯消元求期望)
Rating Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
- HDU 6143 - Killer Names | 2017 Multi-University Training Contest 8
/* HDU 6143 - Killer Names [ DP ] | 2017 Multi-University Training Contest 8 题意: m个字母组成两个长为n的序列,两序列中 ...
随机推荐
- C# WPF打印报表
前天我的一个同学由于打印报表而苦恼,所以就介绍了一下WPF的打印报表,希望能帮助到大家. 展示报表 1. 首先新建项“报表”,选定项目,右击,点击“添加”->“新建项”->“报表”
- CSS属性--过渡(transtion)
首先介绍一下transition的属性取值: transition-property : 主要设置对象中的参与过渡的属性,包括(border-color,background-color,color) ...
- 仪表盘 hostmap 新玩法让运维工作越玩越 high
Cloud Insight 第13次新品发布会现在开始,首先非常感谢大家前来看我们的新功能发布会,下面我先给大家介绍一下新功能,之后有什么问题大家尽管问
- Open multiple Eclipse workspaces on the Mac
This seems to be the supported native method in OS X: cd /Applications/eclipse/ open -n Eclipse.app ...
- recursion lead to out of memory
There are two storage areas involved: the stack and the heap. The stack is where the current state o ...
- 【leetcode】Add Two Numbers(middle) ☆
You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...
- mahout安装配置
1.下载mahout 下载地址:http://mahout.apache.org 我下载的最新版:mahout-distribution-0.9 2.把mahout解压到你想存放的文档,我是放在/Us ...
- HDU 1227 Fast Food (DP)
题目链接 题意 : 有n个饭店,要求建k个供应点,要求每个供应点一定要建造在某个饭店的位置上,然后饭店都到最近的供应点拿货,求出所有饭店到最近的供应点的最短距离. 思路 : 一开始没看出来是DP,后来 ...
- 【mysql的编程专题④】存储过程
类似函数,但是没有返回值,把sql进行封装,便于多次使用或多种应用程序共享使用.不能用在SQL语句中,只能使用CALL调用; 创建存储过程 语法 CREATE PROCEDURE sp_name ([ ...
- Linux内核的同步机制
本文详细的介绍了Linux内核中的同步机制:原子操作.信号量.读写信号量和自旋锁的API,使用要求以及一些典型示例 一.引言 在现代操作系统里,同一时间可能有多个内核执行流在执行,因此内核其实象多进程 ...