結果
| 問題 |
No.1084 積の積
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-11-07 12:15:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 194 ms / 2,000 ms |
| コード長 | 439 bytes |
| コンパイル時間 | 380 ms |
| コンパイル使用メモリ | 82,756 KB |
| 実行使用メモリ | 91,136 KB |
| 最終ジャッジ日時 | 2024-09-25 23:19:03 |
| 合計ジャッジ時間 | 5,255 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 27 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
print(0)
exit()
mod = 10 ** 9 + 7
from collections import *
Q = deque()
val, now = 1, 1
inf = 10 ** 9
ans = 1
for i in range(N - 1, -1, -1):
Q.appendleft(A[i])
now *= A[i]
val *= pow(A[i], len(Q), mod)
val %= mod
while now >= inf:
a = Q.pop()
val *= pow(now, mod-2, mod)
now //= a
ans *= val
ans %= mod
print(ans)
rlangevin