結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー prd_xxxprd_xxx
提出日時 2023-05-28 14:31:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 78,924 KB
最終ジャッジ日時 2023-08-27 10:02:38
合計ジャッジ時間 4,497 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
78,516 KB
testcase_01 WA -
testcase_02 AC 122 ms
78,368 KB
testcase_03 AC 132 ms
78,360 KB
testcase_04 WA -
testcase_05 AC 124 ms
78,576 KB
testcase_06 AC 130 ms
78,504 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 116 ms
78,372 KB
testcase_11 AC 123 ms
78,476 KB
testcase_12 AC 118 ms
78,436 KB
testcase_13 WA -
testcase_14 AC 137 ms
78,644 KB
testcase_15 WA -
testcase_16 AC 115 ms
78,488 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 124 ms
78,784 KB
testcase_20 AC 108 ms
78,072 KB
testcase_21 AC 107 ms
77,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P = map(int,input().split())
MOD = 10**9+7

MAXN = 10**5 + 15
sieve = [i for i in range(MAXN+1)]
p = 2
while p*p <= MAXN:
    if sieve[p] == p:
        for q in range(2*p,MAXN+1,p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1
def is_prime(n):
    return sieve[n] == n

from collections import Counter
fc = Counter()
f = 1
for n in range(2,N+1):
    m = n
    while sieve[m] > 1:
        fc[sieve[m]] += 1
        f *= sieve[m]
        f %= MOD
        m //= sieve[m]

#xc = Counter()
x = 1
for k,v in fc.items():
    #xc[k] = v*f%MOD
    x *= pow(k,v*f,MOD)
    x %= MOD

ans = fc[P] * x % MOD
print(ans)
0