QOJ.ac

QOJ

時間限制: 10 s 記憶體限制: 512 MB 總分: 100

#2623. 十万个点

统计

你在平面上放置了 $n$ 个点,坐标分别为 $(1, 0), (2, 0), \dots, (n, 0)$。

非正式地说,对于每个 $i$,你从顶点 $(i, 0)$ 处画出一个角度为 $a_i$ 度的角,其方向是独立且均匀随机选择的。

正式地说,对于每个 $i$,选择一个实数变量 $\alpha_i \in [0; 360)$,该变量服从均匀分布。这个角由从点 $(i, 0)$ 出发的两条射线组成,它们的极角分别为 $\alpha_i$ 度和 $\alpha_i + a_i$ 度。角的内部由所有从点 $(i, 0)$ 出发,极角严格介于 $\alpha_i$ 和 $\alpha_i + a_i$ 度之间的点组成。

如果存在一个点同时属于两个角的内部,则称这两个角相交。

求没有任何两个角相交的概率,对 $998\,244\,353$ 取模(详见输出部分)。

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 10^5$)。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 179$)。

输出格式

输出没有任何两个角相交的概率,对 $998\,244\,353$ 取模。

形式化地,令 $M = 998\,244\,353$。可以证明所求概率可以表示为不可约分数 $\frac{p}{q}$,其中 $p$ 和 $q$ 为整数且 $q \not\equiv 0 \pmod M$。输出等于 $p \cdot q^{-1} \pmod M$ 的整数。换句话说,输出一个整数 $x$,满足 $0 \le x < M$ 且 $x \cdot q \equiv p \pmod M$。

样例

样例输入 1

2
90 90

样例输出 1

686292993

样例输入 2

3
90 90 90

样例输出 2

982646785

样例输入 3

3
120 30 60

样例输出 3

795861094

说明

在第一个样例测试中,实际概率为 $\frac{5}{16}$。

在第二个样例测试中,实际概率为 $\frac{1}{64}$。

在第三个样例测试中,实际概率为 $\frac{347}{5184}$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.