题意

有1~n镜子,每个镜子说你漂亮的概率是pi/100,如果第i个回答你漂亮那么就一直问到第n个说漂亮为止,否则重新从1开始问,一天只问一个镜子,问直到镜子n说你漂亮的期望天数。

思路

设Ei为问到第i个镜子直到第n个成功的期望天数。

看以下推导:

代码

#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=998244353;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
ll read()
{
ll x=0;
char ch=getchar();
while(!isdigit(ch))
{
ch=getchar();
}
while(isdigit(ch))
{
x=x*10+(ch-'0');
ch=getchar();
}
return x;
}
ll p[N];
int main()
{
std::ios::sync_with_stdio(false);
ll n=read(),sum=0,tmp=1;
for(int i=1;i<=n;i++)
{
p[i]=read();
}
for(int i=n;i>=1;i--)
{
tmp=inv(p[i]*inv(100,mod)%mod,mod)*tmp%mod;
sum=(sum+tmp)%mod;
}
cout<<sum<<endl;
return 0;
}

  

CodeForces-1265E(期望)的更多相关文章

  1. [Codeforces 1265E]Beautiful Mirrors

    Description 题库链接 一共有 \(n\) 个关卡,你初始在第一个关卡.通过第 \(i\) 个关卡的概率为 \(p_i\).每一轮你可以挑战一个关卡.若通过第 \(i\) 个关卡,则进入第 ...

  2. Intergalaxy Trips CodeForces - 605E (期望,dijkstra)

    大意: 给定矩阵$p$, $p_{i,j}$表示每一秒点$i$到点$j$有一条边的概率, 每秒钟可以走一条边, 或者停留在原地, 求最优决策下从$1$到$n$的期望用时. $f_x$为从$x$到$n$ ...

  3. Crossword Expert CodeForces - 1194F (期望)

    大意: $n$个题, 按照第$i$题随机$t_i$或$t_i+1$秒钟完成, 最多做$T$秒, 求做题数期望. 期望转为做题数$\ge x$的方案数之和最后再除以总方案数 这是因为$\sum\limi ...

  4. Codeforces 1264C/1265E Beautiful Mirrors with queries (概率期望、DP)

    题目链接 http://codeforces.com/contest/1264/problem/C 题解 吐槽:为什么我赛后看cf的题就经常1h内做出Div.1 C, 一打cf就动不动AB题不会啊-- ...

  5. Codeforces 123E Maze(树形DP+期望)

    [题目链接] http://codeforces.com/problemset/problem/123/E [题目大意] 给出一棵,给出从每个点出发的概率和以每个点为终点的概率,求出每次按照dfs序从 ...

  6. Codeforces 866C Gotta Go Fast - 动态规划 - 概率与期望 - 二分答案

    You're trying to set the record on your favorite video game. The game consists of N levels, which mu ...

  7. Codeforces 839C Journey - 树形动态规划 - 数学期望

    There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can r ...

  8. Codeforces 804D Expected diameter of a tree(树形DP+期望)

    [题目链接] http://codeforces.com/contest/804/problem/D [题目大意] 给你一个森林,每次询问给出u,v, 从u所在连通块中随机选出一个点与v所在连通块中随 ...

  9. CodeForces 24D Broken robot(期望+高斯消元)

    CodeForces 24D Broken robot 大致题意:你有一个n行m列的矩形板,有一个机器人在开始在第i行第j列,它每一步会随机从可以选择的方案里任选一个(向下走一格,向左走一格,向右走一 ...

  10. Codeforces A. Game on Tree(期望dfs)

    题目描述: Game on Tree time limit per test 1 second memory limit per test 256 megabytes input standard i ...

随机推荐

  1. Coderforces-455A

    Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winte ...

  2. 基于iCamera测试mt9m034 1280X960 高动态相机模块小结

    基于iCamera测试mt9m034 高动态相机模块小结 首先看看此模块的特性 mt9m034 高动态 CMOS模块 1280*960像素 5.48 V/lux-sec >115db 摄像头模块 ...

  3. Django 06

    目录 注意 聚合查询 分组查询 F与Q查询 orm字段和参数 自定义字段类型 事务 ACID 三大范式 开启事务 注意 只要和数据库相关的功能, 基本在 django.db.models 里面 聚合查 ...

  4. 建议3:正确处理Javascript特殊值---(1)正确使用NaN和Infinity

    NaN时IEEE 754中定义的一个特殊的数量值.他不表示一个数字,尽管下面的表达式返回的是true typeof(NaN) === 'number' //true 该值可能会在试图将非数字形式的字符 ...

  5. EFCore连接池的坑 差点晚年不保

    长话短说 上个月公司上线了一个物联网数据科学项目,我主要负责前端接受物联网事件,并提供 参数下载. webapp 部署在Azure云上,参数使用Azure SQL Server存储. 最近从灰度测试转 ...

  6. 微服务架构 SpringBoot(二)

    第二天内容:想来想去玩个ssm小demo吧 1.创建表 2..引入相关mybatis 数据库jar: <!--mybatis --> <dependency> <grou ...

  7. tyvj 1387 迷你火车头

    dp百题进度条[1/100] 一列火车有一个火车头拖着一长串的车厢,每个车厢有若干个乘客. 一旦火车头出了故障,所有的车厢就只能停在铁轨上了,因此铁路局给每列火车配备了三个迷你火车头,每个迷你火车头可 ...

  8. Dc:7 Vulnhub Walkthrough

    靶机下载地址: https://www.vulnhub.com/entry/dc-7,356/ 主机扫描: http://10.10.202.161/ Google搜索下: SSH 登录 以上分析得出 ...

  9. deinit 没执行

    写了一个自定义的UIView,其中包含代理       然后设置UIViewController为此UIView的代理       结果UIViewController里的deinit没执行,导致内存 ...

  10. 换了网线异常了,CRS无法正常启动,clssnmSendingThread: sending status msg to all nodes

    换了网线异常了,CRS无法正常启动,clssnmSendingThread: sending status msg to all nodes同事换网线前我将节点2正常关闭了,换完网线告诉我,发现节点2 ...