CF913H.Don't Exceed

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You generate real numbers s1,s2,...,sns_{1},s_{2},...,s_{n} as follows:

  • s0=0s_{0}=0 ;
  • si=si1+tis_{i}=s_{i-1}+t_{i} , where tit_{i} is a real number chosen independently uniformly at random between 0 and 1, inclusive.

You are given real numbers x1,x2,...,xnx_{1},x_{2},...,x_{n} . You are interested in the probability that si<=xis_{i}<=x_{i} is true for all ii simultaneously.

It can be shown that this can be represented as , where PP and QQ are coprime integers, and . Print the value of PQ1P·Q^{-1} modulo 998244353998244353 .

输入格式

The first line contains integer nn ( 1<=n<=301<=n<=30 ).

The next nn lines contain real numbers x1,x2,...,xnx_{1},x_{2},...,x_{n} , given with at most six digits after the decimal point ( 0<x_{i}<=n ).

输出格式

Print a single integer, the answer to the problem.

输入输出样例

  • 输入#1

    4
    1.00
    2
    3.000000
    4.0
    

    输出#1

    1
    
  • 输入#2

    1
    0.50216
    

    输出#2

    342677322
    
  • 输入#3

    2
    0.5
    1.0
    

    输出#3

    623902721
    
  • 输入#4

    6
    0.77
    1.234567
    2.1
    1.890
    2.9999
    3.77
    

    输出#4

    859831967
    

说明/提示

In the first example, the sought probability is 1 since the sum of ii real numbers which don't exceed 1 doesn't exceed ii .

In the second example, the probability is x1x_{1} itself.

In the third example, the sought probability is 3/83/8 .

首页