結果

問題 No.1237 EXP Multiple!
ユーザー aqua_tenhou
提出日時 2021-06-20 22:44:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 107,776 KB
最終ジャッジ日時 2024-06-22 22:41:40
合計ジャッジ時間 3,630 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))

def fact(n):
    ret = 1
    for i in range(1,n+1):
        ret *= i
    return ret

if min(a) == 0:
    print(-1)
elif max(a) >= 4:
    print(10**9 + 7)

else:
    ans = 1
    for x in a:
        ans *= x**fact(x)
        if ans >= 10**9 + 7:
            print(10**9 + 7)
            exit()
    print((10**9 + 7)%ans)

0