結果

問題 No.1383 Numbers of Product
ユーザー convexineqconvexineq
提出日時 2021-02-18 15:30:34
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 901 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 169,588 KB
最終ジャッジ日時 2024-05-02 10:27:00
合計ジャッジ時間 14,656 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,016 KB
testcase_01 AC 43 ms
53,760 KB
testcase_02 AC 39 ms
53,760 KB
testcase_03 AC 39 ms
54,272 KB
testcase_04 AC 39 ms
54,144 KB
testcase_05 AC 40 ms
53,888 KB
testcase_06 AC 40 ms
53,760 KB
testcase_07 AC 305 ms
150,260 KB
testcase_08 AC 366 ms
150,516 KB
testcase_09 AC 293 ms
152,180 KB
testcase_10 AC 483 ms
169,200 KB
testcase_11 AC 472 ms
169,208 KB
testcase_12 AC 479 ms
169,076 KB
testcase_13 AC 550 ms
169,084 KB
testcase_14 AC 387 ms
152,820 KB
testcase_15 AC 313 ms
149,940 KB
testcase_16 AC 453 ms
169,336 KB
testcase_17 AC 42 ms
53,888 KB
testcase_18 AC 42 ms
53,632 KB
testcase_19 AC 44 ms
54,144 KB
testcase_20 AC 42 ms
53,760 KB
testcase_21 AC 42 ms
53,760 KB
testcase_22 AC 40 ms
53,888 KB
testcase_23 AC 41 ms
54,272 KB
testcase_24 AC 42 ms
54,016 KB
testcase_25 AC 43 ms
53,504 KB
testcase_26 AC 43 ms
54,144 KB
testcase_27 AC 44 ms
54,400 KB
testcase_28 AC 52 ms
65,408 KB
testcase_29 AC 376 ms
152,308 KB
testcase_30 AC 477 ms
169,204 KB
testcase_31 AC 42 ms
54,144 KB
testcase_32 AC 117 ms
110,464 KB
testcase_33 AC 41 ms
54,016 KB
testcase_34 AC 45 ms
61,312 KB
testcase_35 AC 360 ms
169,200 KB
testcase_36 AC 505 ms
168,684 KB
testcase_37 AC 586 ms
169,080 KB
testcase_38 AC 504 ms
169,332 KB
testcase_39 AC 396 ms
169,076 KB
testcase_40 AC 394 ms
168,952 KB
testcase_41 AC 560 ms
169,080 KB
testcase_42 AC 462 ms
169,068 KB
testcase_43 AC 571 ms
169,072 KB
testcase_44 AC 387 ms
169,076 KB
testcase_45 AC 468 ms
169,076 KB
testcase_46 AC 40 ms
53,668 KB
testcase_47 AC 467 ms
169,076 KB
testcase_48 AC 482 ms
169,588 KB
testcase_49 AC 472 ms
169,336 KB
testcase_50 AC 563 ms
169,060 KB
testcase_51 AC 44 ms
54,016 KB
testcase_52 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
n,k,m = map(int,input().split())

from collections import Counter
d = Counter()
for b in range(3,50):
    for a in range(1,10**6+1):
        x = a
        for i in range(1,b):
            x *= a + i*k
            if x > n: break
        if x <= n:
            d[x] += 1
        else:
            break
    if a==1: break

def check(x): # a(a+k) = x なる a ある?
    v = int((sqrt(float(k)**2 + 4.0*x) - k)/2)
    for a in range(max(1,v-2),v+10):
        if a >= 1 and a*(a+k)==x: return True
        if a*(a+k) > x: return False
    return False

ans = 0
for x,v in d.items():
    if v == m and not check(x):
        ans += 1
    elif v == m-1 and check(x):
        ans += 1

if m == 1:
    v = int((sqrt(float(k)**2 + 4.0*n) - k)/2)
    for a in range(max(1,v-2),v+10):
        if a*(a+k) > n: break
    ans += a-1
    for x in d:
        if check(x): ans -= 1

print(ans)
0