結果
問題 |
No.847 Divisors of Power
|
ユーザー |
![]() |
提出日時 | 2020-01-05 20:06:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 138 ms / 2,000 ms |
コード長 | 755 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 82,204 KB |
実行使用メモリ | 77,612 KB |
最終ジャッジ日時 | 2024-11-22 23:30:02 |
合計ジャッジ時間 | 2,963 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
import sys sys.setrecursionlimit(10 ** 7) def fctr1(n): f=[] c=0 r=int(n**0.5) for i in range(2,r+2): while n%i==0: c+=1 n=n//i if c!=0: f.append([i,c]) c=0 if n!=1: f.append([n,1]) return f def main(): N, K, M = map(int, input().split()) d = fctr1(N) for i in range(len(d)): d[i][1] = d[i][1] * K def dfs(x, y): if x == len(d): return 1 cnt = 0 tmp = 1 for i in range(d[x][1] + 1): tmp = y * (d[x][0] ** i) if tmp > M: break cnt += dfs(x + 1, tmp) return cnt print(dfs(0,1)) if __name__ == "__main__": main()