結果

問題 No.1383 Numbers of Product
ユーザー convexineqconvexineq
提出日時 2021-02-09 18:26:13
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,015 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 247,576 KB
最終ジャッジ日時 2023-10-12 02:59:09
合計ジャッジ時間 26,927 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,568 KB
testcase_01 AC 96 ms
71,616 KB
testcase_02 AC 95 ms
71,668 KB
testcase_03 AC 95 ms
71,584 KB
testcase_04 AC 96 ms
71,672 KB
testcase_05 AC 95 ms
71,740 KB
testcase_06 AC 95 ms
71,872 KB
testcase_07 AC 527 ms
174,924 KB
testcase_08 AC 573 ms
174,780 KB
testcase_09 AC 509 ms
210,508 KB
testcase_10 AC 809 ms
246,576 KB
testcase_11 AC 866 ms
246,580 KB
testcase_12 AC 807 ms
246,588 KB
testcase_13 AC 888 ms
246,352 KB
testcase_14 AC 637 ms
211,312 KB
testcase_15 AC 519 ms
175,792 KB
testcase_16 AC 766 ms
246,972 KB
testcase_17 AC 94 ms
71,712 KB
testcase_18 AC 96 ms
71,680 KB
testcase_19 AC 95 ms
71,600 KB
testcase_20 AC 96 ms
71,740 KB
testcase_21 AC 100 ms
71,504 KB
testcase_22 AC 94 ms
71,924 KB
testcase_23 AC 95 ms
71,656 KB
testcase_24 AC 95 ms
71,860 KB
testcase_25 AC 94 ms
71,748 KB
testcase_26 AC 97 ms
72,112 KB
testcase_27 AC 98 ms
71,984 KB
testcase_28 AC 116 ms
78,864 KB
testcase_29 AC 615 ms
211,068 KB
testcase_30 AC 783 ms
246,624 KB
testcase_31 AC 95 ms
71,756 KB
testcase_32 AC 205 ms
101,588 KB
testcase_33 AC 95 ms
71,848 KB
testcase_34 AC 103 ms
77,096 KB
testcase_35 AC 625 ms
228,508 KB
testcase_36 AC 802 ms
227,824 KB
testcase_37 AC 923 ms
247,576 KB
testcase_38 AC 802 ms
247,144 KB
testcase_39 AC 666 ms
247,076 KB
testcase_40 AC 679 ms
246,892 KB
testcase_41 AC 912 ms
247,148 KB
testcase_42 AC 786 ms
247,300 KB
testcase_43 AC 921 ms
247,308 KB
testcase_44 AC 687 ms
247,148 KB
testcase_45 AC 774 ms
246,900 KB
testcase_46 AC 96 ms
71,616 KB
testcase_47 AC 773 ms
247,152 KB
testcase_48 AC 780 ms
246,808 KB
testcase_49 AC 795 ms
247,140 KB
testcase_50 AC 936 ms
246,868 KB
testcase_51 WA -
testcase_52 AC 96 ms
71,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def val(a,s):
    v = float(a)
    for i in range(1,s):
        v *= a+i*fk
        if v > 2e18: return 2000000000000000000
    w = a
    for i in range(1,s):
        w *= a+i*k
    return w

from collections import Counter
d = Counter()
for s in range(3,100):
    if val(1,s) > n: break
    for a in range(1,10**6+1):
        x = val(a,s)
        if x <= n: d[x] += 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*n) - 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