1、题意:这就是说考试的时候抄串了一位能对几个(雾)

2、分析:这是一个期望问题,期望就是平均,E(a+b)=E(a)+E(b),所以我们直接算出每个点能对几个就好,那么就是1/max(a[i],a[i%n+1])就好,最后加起来

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
#define LL long long
#define M 10000010

inline int read(){
    char ch = getchar(); int x = 0, f = 1;
    while(ch < '0' || ch > '9'){
        if(ch == '-') f = -1;
        ch = getchar();
    }
    while('0' <= ch && ch <= '9'){
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

int a[M];

int main(){
    int n, A, B, C;
    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;
    double ans = 0;
    for(int i = 1; i <= n; i ++){
        ans += 1.0 / max(a[i], a[i % n + 1]);
    }
    printf("%.3lf\n", ans);
    return 0;
}

BZOJ2134——单选错位的更多相关文章

  1. bzoj2134单选错位

    bzoj2134单选错位 题意: 试卷上n道选择题,每道分别有ai个选项.某人全做对了,但第i道题的答案写在了第i+1道题的位置,第n道题答案写在第1题的位置.求期望能对几道.n≤10000000 题 ...

  2. BZOJ2134: 单选错位

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2134 题解:因为每个答案之间是互不影响的,所以我们可以挨个计算. 假设当前在做 i 题目,如果 ...

  3. bzoj2134: 单选错位(trie)

    预处理前后缀异或和,用trie得到前后缀最大答案,枚举中间点把左右两边加起来就是当前中间点的最大答案了...这个操作没见过,比较有意思,记录一下 #include<iostream> #i ...

  4. BZOJ2134: 单选错位(期望乱搞)

    Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1101  Solved: 851[Submit][Status][Discuss] Descripti ...

  5. BZOJ2134 luoguP1297 [国家集训队]单选错位

    单选错位 [问题描述] gx和lc去参加noip初赛,其中有一种题型叫单项选择题,顾名思义,只有一个选项是正确答案.试卷上共有n道单选题,第i道单选题有ai个选项,这ai个选项编号是1,2,3,…,a ...

  6. BZOJ 2134: 单选错位( 期望 )

    第i个填到第i+1个的期望得分显然是1/max(a[i],a[i+1]).根据期望的线性性, 我们只需将每个选项的期望值累加即可. ---------------------------------- ...

  7. BZOJ_2134_单选错位——期望DP

    BZOJ_2134_单选错位——期望DP 题意: 分析:设A为Ai ∈ [1,ai+1] 的概率,B为Ai = A(imodn+1)的概率显然P(A|B) = 1,那么根据贝叶斯定理P(B) = P( ...

  8. P1297 [国家集训队]单选错位(期望)

    P1297 [国家集训队]单选错位 期望入门 我们考虑涂到第$i$道题时的情况 此时题$i$答案有$a[i]$种,我们可能涂$a[i+1]$种 分类讨论: 1.$a[i]>=a[i+1]$: 可 ...

  9. Luogu P1297 [国家集训队]单选错位

    P1297 [国家集训队]单选错位 题目背景 原 <网线切割>请前往P1577 题目描述 gx和lc去参加noip初赛,其中有一种题型叫单项选择题,顾名思义,只有一个选项是正确答案.试卷上 ...

随机推荐

  1. css动画

    阅读目录 css3中与动画相关的标签 animation transition 与动画无关的transform 浏览器兼容 css3中与动画相关的标签 1.animation标签 不同浏览器的动画属性 ...

  2. [LeetCode] Flip Game 翻转游戏之二

    You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

  3. [LeetCode] Gray Code 格雷码

    The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...

  4. Html-IOS下input的样式添加不上的解决方案

    问题描述: <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml&qu ...

  5. NFS简单使用

    NFS网络文件系统(Network File System),由Sun公司开发,从名字上就能够知道这个服务是通过网络的方式来共享文件系统,目前RHEL 6上使用的版本为NFSv4,提供有状态的连接,追 ...

  6. 用 ElementTree 在 Python 中解析 XML

    用 ElementTree 在 Python 中解析 XML 原文: http://eli.thegreenplace.net/2012/03/15/processing-xml-in-python- ...

  7. neo4j-java连接

    本例使用neo4j3.0.1架包 使用maven下载架包 <!-- https://mvnrepository.com/artifact/org.neo4j/neo4j-jdbc-driver ...

  8. java-读取javabean类的set方法并设值

    /** * 新反射实例化模型 * @param filenamepath * @return */ public static Object newIntence(String filenamepat ...

  9. JS中使用MD5加密

    下载 MD5 使用MD5加密的方法:下载md5.js文件,在网页中引用该文件: < script type="text/javascript" src="md5.j ...

  10. UML大战需求分析--阅读笔记3

    这次阅读的是第四章,流程分析利器之 – 活动图.对需求有两种分析的方式:结构建模与行为建模.活动图是行为建模中经常使用的一种图.由流程图发展而来. 活动图中有一些名词:开始状态.结束状态.活动.判断. ...