QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#3724. 奇异素数

统计

Bobo 在 ICPCCamp 中发现了一个奇怪的素数 $P = 10^{10} + 19$,他决定写下 $n$ 个整数 $x_1, x_2, \dots, x_n$,使得它们的和是 $P$ 的倍数,同时对于给定的 $a_1, a_2, \dots, a_n$,满足 $0 \leq x_i < P - a_i$。

Bobo 想知道写下 $x_1, x_2, \dots, x_n$ 的不同方案数,结果对 $(10^9+7)$ 取模。

输入包含零个或多个测试用例,并以文件结束符(EOF)终止。对于每个测试用例:

第一行包含一个整数 $n$。 第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$。

  • $1 \leq n \leq 10^5$
  • $0 \leq a_i \leq 10^5$
  • 所有测试用例的 $n$ 之和不超过 $10^6$。

对于每个测试用例,输出一个整数,表示不同方案的数量。

样例

输入格式 1

2
0 0

输出格式 1

999999956

输入格式 2

3
0 1 2

输出格式 2

2756

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.