結果
問題 |
No.847 Divisors of Power
|
ユーザー |
|
提出日時 | 2022-08-10 22:58:58 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 975 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 83,328 KB |
最終ジャッジ日時 | 2024-09-21 08:45:49 |
合計ジャッジ時間 | 4,972 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | AC * 15 TLE * 1 -- * 10 |
ソースコード
# verification-helper: PROBLEM https://yukicoder.me/problems/no/847 import sys sys.path.append("../../") def factorization(n: int) -> int: arr, tmp = [], n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if tmp % i == 0: cnt = 0 while tmp % i == 0: cnt += 1 tmp //= i arr.append([i, cnt]) if tmp != 1: arr.append([tmp, 1]) return arr def dfs(a: list): global ans if len(a) == l: cnt = 1 for i in range(len(a)): cnt *= fac[i][0] ** a[-1 - i] if cnt <= m: ans += 1 return for i in range(num[l - len(a) - 1] + 1): dfs(a + [i]) n, k, m = map(int, input().split()) fac = factorization(n) l = len(fac) num = [-1] * l for i in range(l): fac[i][1] *= k cnt = 0 while fac[i][0] ** cnt <= m and cnt <= fac[i][1]: cnt += 1 num[i] = cnt - 1 ans = 0 dfs([]) print(ans)