結果

問題 No.1383 Numbers of Product
ユーザー convexineqconvexineq
提出日時 2021-02-09 18:12:33
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 852 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 261,156 KB
最終ジャッジ日時 2023-09-21 05:45:44
合計ジャッジ時間 20,558 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,220 KB
testcase_01 AC 98 ms
71,268 KB
testcase_02 RE -
testcase_03 AC 97 ms
71,500 KB
testcase_04 WA -
testcase_05 AC 98 ms
71,448 KB
testcase_06 AC 99 ms
71,656 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 315 ms
198,064 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 103 ms
71,528 KB
testcase_18 AC 99 ms
71,592 KB
testcase_19 AC 96 ms
71,560 KB
testcase_20 RE -
testcase_21 AC 99 ms
71,476 KB
testcase_22 RE -
testcase_23 AC 98 ms
71,272 KB
testcase_24 RE -
testcase_25 AC 99 ms
71,600 KB
testcase_26 RE -
testcase_27 WA -
testcase_28 AC 110 ms
78,148 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 105 ms
71,308 KB
testcase_32 AC 159 ms
112,172 KB
testcase_33 WA -
testcase_34 AC 100 ms
71,088 KB
testcase_35 AC 358 ms
226,988 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 410 ms
243,892 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 96 ms
71,680 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 RE -
testcase_52 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def is_small(a):
    if float(a)*(a+k)*(a+2*k) > 2e18: return False
    else: return a*(a+k)*(a+2*k) <= n

from collections import Counter
d = Counter()
for a in range(1,10**6+1):
    if is_small(a): d[a*(a+k)*(a+2*k)] += 1
    else: 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-3),v+5):
        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*x) - k)/2)
    for a in range(max(1,v-3),v+5):
        if a*(a+k) > n: break
    ans += a-1
    for x in d:
        if check(x): ans -= 1

print(ans)
0