結果
問題 |
No.1383 Numbers of Product
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:38:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,212 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 82,244 KB |
実行使用メモリ | 83,304 KB |
最終ジャッジ日時 | 2025-06-12 21:42:56 |
合計ジャッジ時間 | 4,125 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 2 TLE * 1 -- * 45 |
ソースコード
import sys import math def count_x_with_f_equals_m(N, K, M): freq = {} max_s = 0 current = 1 s = 1 while current <= N: max_s = s s += 1 current *= (current + K) if s > 1 else 1 for s in range(2, max_s + 1): left = 1 right = 1 while True: try: P = 1 for i in range(s): P *= (right + i * K) if P > N: break right += 1 except: break right -= 1 if right < 1: continue for A in range(1, right + 1): product = 1 for i in range(s): product *= (A + i * K) if product > N: break if product <= N: if product in freq: freq[product] += 1 else: freq[product] = 1 count = 0 for x in freq: if freq[x] == M: count += 1 return count def main(): N, K, M = map(int, sys.stdin.readline().split()) print(count_x_with_f_equals_m(N, K, M)) if __name__ == "__main__": main()