結果

問題 No.1237 EXP Multiple!
ユーザー ibyiby
提出日時 2020-11-27 02:19:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 30,664 KB
最終ジャッジ日時 2023-10-01 03:50:52
合計ジャッジ時間 2,961 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,292 KB
testcase_01 AC 68 ms
23,924 KB
testcase_02 AC 91 ms
29,360 KB
testcase_03 AC 87 ms
30,300 KB
testcase_04 AC 88 ms
30,664 KB
testcase_05 AC 48 ms
12,184 KB
testcase_06 AC 60 ms
12,276 KB
testcase_07 AC 50 ms
12,284 KB
testcase_08 AC 120 ms
12,328 KB
testcase_09 AC 49 ms
12,256 KB
testcase_10 AC 49 ms
12,264 KB
testcase_11 AC 61 ms
12,144 KB
testcase_12 AC 61 ms
12,320 KB
testcase_13 AC 118 ms
12,136 KB
testcase_14 AC 114 ms
12,128 KB
testcase_15 AC 121 ms
12,284 KB
testcase_16 AC 114 ms
12,184 KB
testcase_17 AC 117 ms
12,280 KB
testcase_18 AC 117 ms
12,132 KB
testcase_19 AC 58 ms
12,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
if any(v == 0 for v in a):
    print(-1)
    exit()
if max(a) > 3:
    print(MOD)
    exit()
else:
    ans = 1
    for v in a:
        ans *= pow(v, math.factorial(v))
        if ans > MOD:
            print(MOD)
            exit()
    print(MOD % ans)
    exit()
0