【BZOJ2134】单选错位 概率DP? 貌似不算DP
来源:互联网 发布:万网域名注册要多少钱 编辑:程序博客网 时间:2024/05/18 08:02
转载请注明出处:http://blog.csdn.net/vmurder/article/details/42879121
题意:输入完了后,第i道题有ai种可能的正确选项,有ai-1种某人可能选的选项,问期望对多少题。
这道题的期望对于两道题之间是无关的。
只需要对每道题单独讨论
a种正确选项,b种可能选项
对于某种正确选项,某人有1/b的概率做对
总几率:1/b/a。
而这样的正确选项有min(a,b)种。
恩,就是这样。
代码:
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define N 10001000using namespace std;int n,A,B,C,a[N];int main(){double ans=0;scanf("%d%d%d%d%d",&n,&A,&B,&C,a+1);for(int i=2;i<=n;i++)a[i]=((long long)a[i-1]*A+B)%100000001;for(int i=1;i<=n;i++)a[i]=a[i]%C+1;a[0]=a[n];for(int i=1;i<=n;i++)ans+=1.00000/(double)max(a[i-1],a[i]);printf("%.3lf\n",ans);return 0;}/*某题若有a种选法,b种正确答案答案则是min(a,b)*(1/a)/b也就是1/max(a,b);*/
0 0
- 【BZOJ2134】单选错位 概率DP? 貌似不算DP
- [BZOJ2134]单选错位(概率期望)
- BZOJ2134: 单选错位
- BZOJ2134 单选错位
- bzoj2134: 单选错位
- BZOJ2134 单选错位
- 【bzoj2134】单选错位
- bzoj2134 单选错位
- bzoj2134 单选错位 递推
- BZOJ2134——单选错位
- BZOJ 2134 单选错位 期望DP
- bzoj 2134: 单选错位 期望dp
- 2134: 单选错位|概率与期望
- 2134: 单选错位 概率与期望
- 【BZOJ 2134】单选错位 概率
- 概率dp
- ##概率dp##
- 概率dp
- 程序执行时间的函数
- uva 714 Copying Books
- 分布式系统若干经验总结
- ITOO中的EasyUI—右键关闭选项卡
- 变量声明和定义的区别
- 【BZOJ2134】单选错位 概率DP? 貌似不算DP
- 一些常用的工具软件
- android开发者交流
- Codeforces Round #286 (Div. 2)C. Mr. Kitayuta, the Treasure Hunter
- php生成随机数据(数字、大小写字母混合)
- resolve problem II - Could not find or load main class
- 2015年,这15个IT岗位会涨薪?
- 应用框架的设计与实现.net平台--应用框架解析(框架开技术)
- mac下递归创建ctags报错: "illegal option -- R"