結果

問題 No.1237 EXP Multiple!
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-09-25 21:38:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,936 KB
最終ジャッジ日時 2024-06-28 08:31:21
合計ジャッジ時間 3,377 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
n = int(input())
a = list(map(int, input().split()))
a.sort()
if 0 in a:
    exit(print(-1))
ans = 1
for i in range(n):
    if a[i] >= 18:
        exit(print(10 ** 9 + 7))
    ans *= pow(a[i], factorial(a[i]))
    if ans >= 10 ** 9 + 7:
        exit(print(10 ** 9 + 7))
print((10 ** 9 + 7) % ans)
0