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. python的函数

    函数一词起源于数学,但是在编程中的函数和数学中的有很大不同.编程中的函数式组织好的,可重复使用的,用于实现单一功能或相关联功能的代码块. 我们在学习过程中已经使用过一些python内建的函数,如pri ...

  2. BZOJ 1927: [Sdoi2010]星际竞速

    1927: [Sdoi2010]星际竞速 Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 2051  Solved: 1263[Submit][Stat ...

  3. C++ "+="等运算符使用bug

    昨晚写了一个程序,使用了"+="运算符,结果总不是我想要的,查了一晚没找到,今早才发现: timeInterval = tpImP.staTime - imgPara[serial ...

  4. [LeetCode] Binary Search Tree Iterator 二叉搜索树迭代器

    Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro ...

  5. [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal 由先序和中序遍历建立二叉树

    Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that ...

  6. [LeetCode] Wildcard Matching 外卡匹配

    Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. ...

  7. [LeetCode] Next Permutation 下一个排列

    Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...

  8. 最全的 JavaScript 知识总结

    来源于:http://gcdn.gcpowertools.com.cn/showtopic-28404-1-3.html?utm_source=gold.xitu.io&utm_medium= ...

  9. 常用的一些linux命令

    最近接触到一些linux环境部署的事情,下面分享一些最近使用的比较频繁的一些linux命令~ 1.一次性移动多个文件到一个文件夹里 mv  被移动文件名 -t 目标文件夹 如:mv a.txt b.t ...

  10. JSP和Servlet的中文乱码处理

    JSP和Servlet的中文乱码处理 前几天学习了JSP和Servlet中有关中文乱码的一些问题,写成了博客,今天进行更新一下.应该是可以解决日常的乱码问题了.现在作以下总结希望对需要的人有所帮助.我 ...