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,如果她每次做题都用两个账号中分数低的 ...
随机推荐
- HDU 1890 Robotic Sort(splay)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=1890 [题意] 给定一个序列,每次将i..P[i]反转,然后输出P[i],P[i]定义为当前数字i ...
- 树莓派使用8188eu无线网卡
#已经集成了8188eu驱动的镜像 http://cassidy.pi3g.com/rpi_images/raspbian-wifi-fix130523.7z #需要修改的信息 sudo nano / ...
- mysql统计一张表中条目个数的方法
统计一张表中条目的个通常的SQL语句是: select count(*) from tableName; #or ) from tableName; #or 统计一个列项,如ID select cou ...
- 《Java数据结构与算法》笔记-CH3简单排序
class ArrayBub { private long[] arr; private int nElement; public ArrayBub(int size) { arr = new lon ...
- spice
the following diagram illustrates VD-Interface illustrates display portemphasizing emphasizing e ...
- 转载-MySQL 加锁处理分析
MySQL 加锁处理分析 发表于 2013 年 12 月 13 日 由 hedengcheng 1 背景 1 1.1 MVCC:Snapshot Read vs Current Re ...
- 现代程序设计 homework-07
现代程序设计 homework-07 这次作业是要阅读C++11的新特性,按照老师blog提供的链接稍微学习了一下,一下就是一些学习总结(或者说就是介绍)之类的:由于英文能力有限,并且很多中文资料也都 ...
- codeforces 617BChocolate
B. Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- [iOS UI进阶 - 5.0] 手势解锁Demo
A.需求 1.九宫格手势解锁 2.使用了绘图和手势事件 code source: https://github.com/hellovoidworld/GestureUnlockDemo B ...
- wordpress后台打开慢/卡顿的解决方法
---------------------2014年12月29日更新--------------------- 我已经用下面提到的第三种方法禁用了谷歌字体了,最近wordpress后台还是莫名奇妙地非 ...