题面

Bzoj

Sol

第\(i\)道题选对的概率就是\(\frac{min(a[i-1], a[i])}{a[i]*a[i-1]}\)

# include <bits/stdc++.h>
# define RG register
# define IL inline
# define Fill(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll;
const int _(1e7 + 5);
const int Zsy(1e8 + 1); IL int Input(){
RG int x = 0, z = 1; RG char c = getchar();
for(; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
for(; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
return x * z;
} int n, a[_];
double ans; int main(RG int argc, RG char* argv[]){
n = Input(); RG int A = Input(), B = Input(), C = Input(); a[1] = Input();
for(RG int i = 2; i <= n; ++i) a[i] = (1LL * a[i - 1] * A % Zsy + B) % Zsy;
for(RG int i = 1; i <= n; ++i) a[i] = a[i] % C + 1;
a[0] = a[n];
for(RG int i = 1; i <= n; ++i) ans += 1.0 * min(a[i - 1], a[i]) / (1.0 * a[i] * a[i - 1]);
printf("%.3lf\n", ans);
return 0;
}

最新文章

  1. 8.仿阿里云虚拟云服务器的FTP(包括FTP文件夹大小限制)
  2. 由于OCR文件损坏造成Oracle RAC不能启动的现象和处理方法
  3. spring boot redis缓存JedisPool使用
  4. ActiveReports 报表应用教程 (1)---Hello ActiveReports
  5. python学习第四天第一部分
  6. 一个int类型究竟占多少个字节
  7. chisel中pviews命令无法使用
  8. WampServer:轻松配置Wordpress安装环境
  9. pip install -r requirements.txt 安装mysqldb失败 解决方案
  10. react programming
  11. [刷题]算法竞赛入门经典(第2版) 5-1/UVa1593 - Alignment of Code
  12. oracle创建数据库到2%不动问题
  13. linux内核中的C语言常规算法(前提:你的编译器要支持typeof和type)
  14. cad巧用插件自定义填充图形
  15. 什么是 Meta Learning / Learning to Learn ?
  16. 网易的Spark技术实践
  17. 微信小程序源码案例大全
  18. pymysql的使用心得(1)------小细节,注意!
  19. Web Services简单介绍
  20. 【EF】EF扩展库(批量操作)

热门文章

  1. 使用mybatis插入自增主键ID的数据后返回自增的ID
  2. CEF小白人系列1-认识CEF
  3. 三、scrapy后续
  4. 基于微软企业库的AOP组件(含源码)
  5. maven使用jstl表达式和The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application解决
  6. Action里面的自带的字段的含义
  7. Windows下如何硬盘安装Ubuntu
  8. Navicat远程连接阿里云服务器的mysql
  9. R+大地图时代︱ leaflet/leafletCN 动态、交互式绘制地图(遍地代码图)
  10. bootstrap 幻灯大图结合dedecms的autoindex