CF1866M.Mighty Rock Tower
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Pak Chanek comes up with an idea in the midst of boredom to play a game. The game is a rock tower game. There is a big rock that is used as a base. There are also N small identical rocks that Pak Chanek will use to build a rock tower with a height of N above the base rock.
Initially, there are no small rocks that are located above the base rock. In other words, the height of the tower above the base rock is initially 0 . In one move, Pak Chanek can place one small rock onto the top of the tower which makes the height of the tower above the base rock increase by 1 . Each time Pak Chanek place one small rock, the following will happen after the small rock is placed:
- Let's say x is the height of the tower above the base rock right after the small rock is placed.
- There is a probability of Px percent that the topmost rock falls.
- If x≥2 and the topmost rock falls, then there is another probability of Px percent that the 2 -nd topmost rock also falls.
- If x≥3 and the 2 -nd topmost rock falls, then there is another probability of Px percent that the 3 -rd topmost rock also falls.
- If x≥4 and the 3 -rd topmost rock falls, then there is another probability of Px percent that the 4 -th topmost rock also falls.
- And so on.
If the tower successfully reaches a height of N without any rocks falling after that, then the game is ended.
If given an integer array [P1,P2,…,PN] , what is the expected value of the number of moves that Pak Chanek needs to do to end the game? It can be proven that the expected value can be represented as an simple fraction QP where Q is coprime to 998244353 . Output the value of P×Q−1 modulo 998244353 .
输入格式
The first line contains a single integer N ( 1≤N≤2⋅105 ) — the required height of the rock tower.
The second line contains N integers P1,P2,P3,…,PN ( 0≤Pi≤99 ).
输出格式
An integer representing the expected value of the number of moves that Pak Chanek needs to do to end the game, modulo 998244353 .
输入输出样例
输入#1
2 80 50
输出#1
499122186
输入#2
3 25 16 20
输出#2
879786027
说明/提示
In the first example, the expected value of the number of moves that Pak Chanek needs to do to end the game is 219 .