結果

問題 No.1383 Numbers of Product
ユーザー H3PO4H3PO4
提出日時 2021-02-07 21:26:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 333,236 KB
最終ジャッジ日時 2023-09-17 20:35:41
合計ジャッジ時間 26,249 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 625 ms
260,176 KB
testcase_01 AC 613 ms
260,436 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 846 ms
260,192 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 WA -
testcase_28 AC 786 ms
231,184 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 937 ms
217,988 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 981 ms
218,284 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 1,703 ms
269,328 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 TLE -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 TLE -
testcase_52 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, K, M = map(int, input().split())

# b >= 2の場合
d = defaultdict(int)
for a in range(1, 10 ** 6):
    tmp = a * (a + K)
    d[tmp] += 1
    for b in range(2, 50):
        tmp *= a + b * K
        if tmp > N:
            break
        d[tmp] += 1

d = dict(d)
twos = 0
for x in d:
    l, r = 0, 10 ** 9
    while r - l > 1:
        m = (r + l) // 2
        if m * (m + K) > x:
            r = m
        else:
            l = m
    if l * (l + K) == x:
        d[x] += 1
        if x <= N:
            twos += 1
if M == 1:
    l, r = 0, 10 ** 9
    while r - l > 1:
        m = (r + l) // 2
        if m * (m + K) > N:
            r = m
        else:
            l = m
    ans = l - twos + 1
else:
    # すでにdictにないやつは考えなくてよい
    ans = sum(v == M for v in d.values())
print(ans)
0