結果

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

ソースコード

diff #

from math import factorial
MOD = 10**9 + 7
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(-1)
    exit(0)
ans = 1
for e in A:
    if e > 10:
        print(MOD)
        exit(0)
    ans *= pow(e,factorial(e))
    if ans > MOD:
        print(MOD)
        exit(0)
if ans == 0:
    print(-1)
else:
    print(MOD%ans)
0