Bzoj2134:单选错位
2024-10-21 03:53:23
题面
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;
}
最新文章
- 8.仿阿里云虚拟云服务器的FTP(包括FTP文件夹大小限制)
- 由于OCR文件损坏造成Oracle RAC不能启动的现象和处理方法
- spring boot redis缓存JedisPool使用
- ActiveReports 报表应用教程 (1)---Hello ActiveReports
- python学习第四天第一部分
- 一个int类型究竟占多少个字节
- chisel中pviews命令无法使用
- WampServer:轻松配置Wordpress安装环境
- pip install -r requirements.txt 安装mysqldb失败 解决方案
- react programming
- [刷题]算法竞赛入门经典(第2版) 5-1/UVa1593 - Alignment of Code
- oracle创建数据库到2%不动问题
- linux内核中的C语言常规算法(前提:你的编译器要支持typeof和type)
- cad巧用插件自定义填充图形
- 什么是 Meta Learning / Learning to Learn ?
- 网易的Spark技术实践
- 微信小程序源码案例大全
- pymysql的使用心得(1)------小细节,注意!
- Web Services简单介绍
- 【EF】EF扩展库(批量操作)
热门文章
- 使用mybatis插入自增主键ID的数据后返回自增的ID
- CEF小白人系列1-认识CEF
- 三、scrapy后续
- 基于微软企业库的AOP组件(含源码)
- 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解决
- Action里面的自带的字段的含义
- Windows下如何硬盘安装Ubuntu
- Navicat远程连接阿里云服务器的mysql
- R+大地图时代︱ leaflet/leafletCN 动态、交互式绘制地图(遍地代码图)
- bootstrap 幻灯大图结合dedecms的autoindex