結果

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

ソースコード

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)
    elif e != 0:
        ans *= pow(e,factorial(e),MOD)
    if ans > MOD:
        print(MOD)
        exit(0)
if ans == 1:
    print(MOD)
else:
    print(MOD%ans)
0