結果
問題 |
No.2326 Factorial to the Power of Factorial to the...
|
ユーザー |
![]() |
提出日時 | 2023-05-28 14:31:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 343 ms |
コンパイル使用メモリ | 82,612 KB |
実行使用メモリ | 74,336 KB |
最終ジャッジ日時 | 2024-12-27 01:52:13 |
合計ジャッジ時間 | 3,003 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 WA * 9 |
ソースコード
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)