Rating
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 786 Accepted Submission(s):
496
Special Judge
Recently, she has found a new kind of programming competition named
"TopTopTopCoder". Every user who has registered in "TopTopTopCoder" system will
have a rating, and the initial value of rating equals to zero. After the user
participates in the contest held by "TopTopTopCoder", her/his rating will be
updated depending on her/his rank. Supposing that her/his current rating is X,
if her/his rank is between on 1-200 after contest, her/his rating will be
min(X+50,1000). Her/His rating will be max(X-100,0) otherwise. To reach 1000
points as soon as possible, this little girl registered two accounts. She uses
the account with less rating in each contest. The possibility of her rank
between on 1 - 200 is P for every contest. Can you tell her how many contests
she needs to participate in to make one of her account ratings reach 1000
points?
single line containing a float number P (0.3 <= P <= 1.0). The meaning of
P is described above.
indicating the expected count of contest she needs to participate in. This
problem is special judged. The relative error less than 1e-5 will be
accepted.
题意 :小女孩注册了两个比赛的帐号,初始分值都为0,每做一次比赛如果排名在前两百名,rating涨50,否则降100,告诉你她每次比赛在前两百名的概率p,如果她每次做题都用两个账号中分数低的那个去做,问她最终有一个账号达到1000分需要做的比赛的次数的期望值。
思路 :可以直接用公式推出来用DP做,也可以列出210个方程组用高斯消元去做。
(1)DP1:离散化。因为50,100,1000都是50的倍数,所以就看作1,2,20。这样做起来比较方便。
定义dp[i]为从 i 分数到达i+1分的期望,状态转移方程:
dp[i] = p+(1-p)*(1+dp[i-2]+dp[i-1]+dp[i]); 在前两百名里增加一分,当不在前两百名里的时候,扣两分,要回到 i+1 分就是1+dp[i-2]+dp[i-1]+dp[i].
mp[i][i]表示两个账号都从0分涨到 i 分的期望,所以mp[i+1][i] = mp[i][i]+dp[i], mp[i+1][i+1] = mp[i+1][i]+dp[i];
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h> using namespace std ; double dp[],mp[][] ; int main()
{
double p ;
while(scanf("%lf",&p) != EOF)
{
dp[] = / p ;
dp[] = / p / p ;
for(int i = ; i < ; i++)
dp[i] = + (-p)*(dp[i-]+dp[i-]+)/p ;
for(int i = ; i < ; i++)
{
mp[i+][i] = mp[i][i]+dp[i] ;
mp[i+][i+] = mp[i+][i] + dp[i] ;
}
printf("%.6lf\n",mp[][]) ;
}
return ;
}
Rating的更多相关文章
- Codefroces 750C:New Year and Rating(思维)
http://codeforces.com/contest/750/problem/C 题意:有n场比赛,每场比赛有一个c,代表比赛结束后分数的增长情况,有一个d,代表这场比赛在div1或者div2打 ...
- AngularJs的UI组件ui-Bootstrap分享(十二)——Rating
Rating是一个用于打分或排名的控件.看一个最简单的例子: <!DOCTYPE html> <html ng-app="ui.bootstrap.demo" x ...
- 从Elo Rating System谈到层次分析法
1. Elo Rating System Elo Rating System对于很多人来说比较陌生,根据wikipedia上的解释:Elo评分系统是一种用于计算对抗比赛(例如象棋对弈)中对手双方技能水 ...
- HDU 4870 Rating(概率、期望、推公式) && ZOJ 3415 Zhou Yu
其实zoj 3415不是应该叫Yu Zhou吗...碰到ZOJ 3415之后用了第二个参考网址的方法去求通项,然后这次碰到4870不会搞.参考了chanme的,然后重新把周瑜跟排名都反复推导(不是推倒 ...
- Elo rating system 模拟
package org.cc.foo_008; import java.util.ArrayList; import java.util.List; import java.util.Random; ...
- HDU4870 Rating(概率)
第一场多校,感觉自己都跳去看坑自己的题目里去了,很多自己可能会比较擅长一点的题目没看,然后写一下其中一道概率题的题解吧,感觉和自己前几天做的概率dp的思路是一样的.下面先来看题意:一个人有两个TC的账 ...
- HDU 4870 Rating 概率DP
Rating Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- hdu 4870 Rating
题目链接:hdu 4870 这题应该算是概率 dp 吧,刚开始看了好几个博客都一头雾水,总有些细节理不清楚,后来看了 hdu 4870 Rating (概率dp) 这篇博客终于有如醍醐灌顶,就好像是第 ...
- HDU 4870 Rating(高斯消元 )
HDU 4870 Rating 这是前几天多校的题目,高了好久突然听旁边的大神推出来说是可以用高斯消元,一直喊着赶快敲模板,对于从来没有接触过高斯消元的我来说根本就是一头雾水,无赖之下这几天做DP ...
- 2014多校第一场J题 || HDU 4870 Rating(DP || 高斯消元)
题目链接 题意 :小女孩注册了两个比赛的帐号,初始分值都为0,每做一次比赛如果排名在前两百名,rating涨50,否则降100,告诉你她每次比赛在前两百名的概率p,如果她每次做题都用两个账号中分数低的 ...
随机推荐
- Kindle Paperwhite 2使用体验
博客开通后一懒就扔下了几十天,着实自惭.鉴于是第一篇,先说点题外话. 一转眼读研的生活已经过去一年有余.曾经的同学已经在职场拼搏,同龄人的生活状态也自然地带给自己一份紧迫感:不敢再贪恋校园生活的安逸, ...
- 在eclipse中配置spark 0.9.1源码的开发环境
一.准备工作: 1.下载release版spark 0.9.1,本次用的版本是spark-0.9.1-bin-cdh4. 2.下载scala IDE 3.0.2,这个版本ide的支持scala 2.1 ...
- linux下改变文件的字符编码
首先确定文件的原始字符编码: $ file -bi test.txt 然后用 iconv 转换字符编码 $ iconv -f from-encoding -t to-encoding file > ...
- 第二百七十七天 how can I 坚持
开玩笑要有个度,哎,或许这就是缘分,很容易受别人影响吗? 中国人为什么会经常抱怨,不抱怨,挺好. 睡觉,红颜祸水,老婆是要能一起 生活的,不是失去,是上天在帮我,哈哈.
- html5+css3中的background: -moz-linear-gradient 用法
在CSS中background: -moz-linear-gradient 让网站背景渐变的属性,目前火狐3.6以上版本和google浏览器支持这个属性. background: -moz-linea ...
- javascript实现栈功能
- WS103C8例程——串口2【worldsing笔记】
在超MINI核心板 stm32F103C8最小系统板上调试Usart2功能:用Jlink 6Pin接口连接WStm32f103c8的Uart2,PC机向mcu发送数据,mcu收到数据后数据加1,回传给 ...
- Android优化系列之ListView优化老生常谈
本文内容:adapter,listview的优化,RecycleBi,google大会推荐优化, 实现ListView的过程,Adapter起到了至关重要的作用,不仅仅因为getview()方法.那么 ...
- 【转】windows上安装gvim
gvim安装包下载: 简明安装说明:1.安装 gvim 安装包中的程序.2.安装 第三方软件安装包中的程序,将 dll 文件放入 system32目录.3.将 bin 目录加入 PATH 环境 ...
- Codeforces Round #332 (Div. 2) B. Spongebob and Joke 水题
B. Spongebob and Joke Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599 ...