結果

問題 No.1237 EXP Multiple!
ユーザー FromBooskaFromBooska
提出日時 2023-09-12 15:38:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 720 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 106,000 KB
最終ジャッジ日時 2023-09-12 15:38:27
合計ジャッジ時間 4,425 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,980 KB
testcase_01 AC 129 ms
99,148 KB
testcase_02 AC 154 ms
100,708 KB
testcase_03 AC 155 ms
100,960 KB
testcase_04 AC 128 ms
99,340 KB
testcase_05 RE -
testcase_06 AC 104 ms
103,844 KB
testcase_07 RE -
testcase_08 AC 109 ms
104,708 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 109 ms
103,900 KB
testcase_12 AC 110 ms
104,696 KB
testcase_13 AC 110 ms
104,488 KB
testcase_14 AC 110 ms
104,724 KB
testcase_15 AC 110 ms
104,800 KB
testcase_16 AC 110 ms
104,436 KB
testcase_17 AC 110 ms
104,432 KB
testcase_18 AC 109 ms
104,712 KB
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# オイラーの小定理とかではない
# 問題文よく読むと、mod 10**9+7を計算式で割る、いつもの逆
# ということは計算式がmodを超えたら答えは常にmod
# 実験するとすぐわかるがaが4以上でmodを超える

from math import factorial
mod = 10**9+7

N = int(input())
A = list(map(int, input().split()))
A.sort()

denominator = 1
ans_flag = False
for i in range(N):
    if A[i]<=3:
        calc = pow(A[i], factorial(A[i]))
        denominator *= calc
        if denominator > mod:
            ans_flag = True
            break
    else:
        ans_flag = True
        break
if ans_flag == True:
    print(mod)
else:
    ans = mod%denominator
    print(ans)
        

0