結果
問題 |
No.2365 Present of good number
|
ユーザー |
|
提出日時 | 2023-06-30 23:05:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 850 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 52,608 KB |
最終ジャッジ日時 | 2024-07-07 11:01:02 |
合計ジャッジ時間 | 2,768 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 37 |
ソースコード
import sys sys.setrecursionlimit(3*10**5) n,k = map(int,input().split()) mod = 10**9+7 def dfs(n,k): if k == 0: return n if n == 1: return 1 if n == 2: s = (k+1)//2 p = pow(2,s,mod-1) if k%2: return pow(3,p,mod) else: return pow(2,p,mod) if n == 4: s = (k+1)//2 p = pow(2,s,mod-1) if k%2: return pow(3,p,mod)**2 else: return pow(2,p,mod)**2 ans = 1 now = n for i in range(2,int(n**0.5)+1): if now%i: continue num = 0 while now%i == 0: now //= i num += 1 ans *= pow(dfs(i+1,k-1),num,mod) ans %= mod if now != 1: ans *= dfs(now+1,k-1) ans %= mod return ans print(dfs(n,k))