CF913H.Don't Exceed
NOI/NOI+/CTSC
通过率:0%
时间限制:4.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You generate real numbers _s_1, _s_2, ..., s__n as follows:
- _s_0 = 0;
- s__i = s__i - 1 + t__i, where t__i is a real number chosen independently uniformly at random between 0 and 1, inclusive.
You are given real numbers _x_1, _x_2, ..., x__n. You are interested in the probability that s__i ≤ x__i is true for all i simultaneously.
It can be shown that this can be represented as
, where P and Q are coprime integers, and
. Print the value of P·Q - 1 modulo 998244353.
你按如下方式生成实数 s1,s2,…,sn:
- s0=0;
- si=si−1+ti,其中 ti 是在区间 [0,1] 上独立均匀随机选取的实数。
给定实数 x1,x2,…,xn。你关心的是:对所有 i 同时满足 si≤xi 的概率。
可以证明,该概率可表示为 QP,其中 P 与 Q 互质,且 Q≡0(mod998244353)。请输出 P⋅Q−1mod998244353 的值。
输入格式
The first line contains integer n (1 ≤ n ≤ 30).
The next n lines contain real numbers _x_1, _x_2, ..., x__n, given with at most six digits after the decimal point (0 < x__i ≤ n).
第一行包含一个整数 n(1≤n≤30)。
接下来的 n 行每行包含一个实数 x1,x2,…,xn,每个数的小数点后最多有六位数字(0<xi≤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 i real numbers which don't exceed 1 doesn't exceed i.
In the second example, the probability is _x_1 itself.
In the third example, the sought probability is 3 / 8.
在第一个例子中,所求概率为 1,因为不超过 1 的 i 个实数之和不会超过 i。
在第二个例子中,概率为 x1 本身。
在第三个例子中,所求概率为 3/8。
输入解题思路,AI测评打分。不知道怎么写?