結果
問題 | No.1237 EXP Multiple! |
ユーザー | FromBooska |
提出日時 | 2023-09-12 15:37:23 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 271 ms |
コンパイル使用メモリ | 87,032 KB |
実行使用メモリ | 105,472 KB |
最終ジャッジ日時 | 2023-09-12 15:37:30 |
合計ジャッジ時間 | 4,963 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,668 KB |
testcase_01 | AC | 126 ms
99,504 KB |
testcase_02 | AC | 155 ms
100,888 KB |
testcase_03 | AC | 158 ms
101,008 KB |
testcase_04 | AC | 123 ms
99,392 KB |
testcase_05 | RE | - |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
# オイラーの小定理とかではない # 問題文よく読むと、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 else: ans_flag = True break if ans_flag == True: print(mod) else: ans = mod%denominator print(ans)