No.1237 EXP Multiple!
レベル :
/ AI推定難易度 : 825
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 225
作問者 :
nok0
/ テスター :
kawara_y_kyopro
タグ : / 解いたユーザー数 225
作問者 :
nok0
/ テスター :
kawara_y_kyopro
問題文最終更新日: 2020-09-25 23:50:48
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 267
(順位表)
の他の問題:
Problem Statement
nok0 is bad at arithmetic.
You are given a sequence of non-negative integers $A_1,A_2,\dots,A_N$ of length $N$. On behalf of nok0, who is in trouble, find $\prod_{k=1}^{N} A_k^{A_k!}$.Since the answer can be very large, output the remainder when the answer is divided by $(10^9+7)$. However, if the answer is $0$, output $-1$ instead.
Constraints
- All inputs are integers.
- $1 \le N \le 2×10^5$
- $0 \le A_i \le 10^9$
Input
$N$
$A_1\ \ A_2\ \dots \ A_N$
Output
If the answer is positive, print the remainder when the answer is divided by $(10^9+7)$ to standard output; otherwise, print $-1$.
Sample
Sample 1
Input
3
3 3 3
Output
225159029
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。