結果
問題 |
No.2365 Present of good number
|
ユーザー |
|
提出日時 | 2023-06-30 23:01:55 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,200 KB |
実行使用メモリ | 81,740 KB |
最終ジャッジ日時 | 2024-07-07 10:57:56 |
合計ジャッジ時間 | 5,338 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 RE * 18 |
ソースコード
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) 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))