結果

問題 No.1237 EXP Multiple!
ユーザー nasubi24nasubi24
提出日時 2020-09-25 23:39:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 30,632 KB
最終ジャッジ日時 2023-09-10 17:30:50
合計ジャッジ時間 3,341 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,792 KB
testcase_01 AC 60 ms
23,736 KB
testcase_02 AC 76 ms
29,104 KB
testcase_03 AC 76 ms
30,196 KB
testcase_04 AC 77 ms
30,632 KB
testcase_05 AC 48 ms
12,124 KB
testcase_06 AC 49 ms
12,128 KB
testcase_07 AC 48 ms
12,056 KB
testcase_08 AC 189 ms
12,204 KB
testcase_09 AC 47 ms
12,084 KB
testcase_10 AC 47 ms
12,128 KB
testcase_11 AC 49 ms
12,200 KB
testcase_12 AC 168 ms
12,248 KB
testcase_13 AC 192 ms
12,132 KB
testcase_14 AC 188 ms
12,052 KB
testcase_15 AC 189 ms
12,220 KB
testcase_16 AC 189 ms
12,128 KB
testcase_17 AC 191 ms
12,128 KB
testcase_18 AC 188 ms
12,188 KB
testcase_19 AC 49 ms
12,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print(-1)
else:
    ans=1
    cnt=0
    for i in range(n):
        cnt2=1
        for j in range(1,a[i]+1):
            cnt2*=j
            if cnt2>10**9+7:
                cnt=1
                break
        if cnt==1:
            break
        ans*=a[i]**cnt2
        if ans>10**9+7:
            cnt=1
            break
    if cnt==1:
        print(10**9+7)
    else:
        print((10**9+7)%ans)
0