結果

問題 No.2417 Div Count
ユーザー pありpあり
提出日時 2023-08-12 15:03:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 70,324 KB
最終ジャッジ日時 2024-04-30 07:52:18
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,056 KB
testcase_01 AC 40 ms
53,672 KB
testcase_02 AC 39 ms
53,056 KB
testcase_03 AC 41 ms
52,508 KB
testcase_04 AC 38 ms
53,052 KB
testcase_05 AC 37 ms
52,700 KB
testcase_06 AC 37 ms
52,896 KB
testcase_07 AC 39 ms
52,524 KB
testcase_08 AC 37 ms
53,072 KB
testcase_09 AC 37 ms
52,816 KB
testcase_10 AC 41 ms
52,472 KB
testcase_11 AC 35 ms
53,792 KB
testcase_12 AC 37 ms
52,564 KB
testcase_13 AC 37 ms
53,068 KB
testcase_14 AC 38 ms
52,260 KB
testcase_15 AC 37 ms
52,720 KB
testcase_16 AC 37 ms
53,352 KB
testcase_17 AC 37 ms
53,324 KB
testcase_18 AC 37 ms
52,520 KB
testcase_19 AC 36 ms
53,008 KB
testcase_20 AC 40 ms
58,364 KB
testcase_21 AC 38 ms
52,736 KB
testcase_22 AC 38 ms
52,840 KB
testcase_23 AC 40 ms
58,136 KB
testcase_24 AC 40 ms
57,984 KB
testcase_25 AC 41 ms
57,508 KB
testcase_26 AC 40 ms
59,152 KB
testcase_27 AC 40 ms
59,580 KB
testcase_28 AC 40 ms
58,704 KB
testcase_29 AC 41 ms
57,744 KB
testcase_30 AC 40 ms
58,164 KB
testcase_31 AC 40 ms
57,712 KB
testcase_32 AC 43 ms
58,112 KB
testcase_33 AC 42 ms
58,708 KB
testcase_34 AC 41 ms
57,792 KB
testcase_35 AC 45 ms
59,264 KB
testcase_36 AC 44 ms
58,372 KB
testcase_37 AC 43 ms
57,776 KB
testcase_38 AC 78 ms
70,324 KB
testcase_39 AC 61 ms
65,956 KB
testcase_40 AC 49 ms
62,996 KB
testcase_41 AC 49 ms
62,420 KB
testcase_42 AC 37 ms
53,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
n,k = map(int, input().split())


a = factorization(n-k)
#print(a)

if(n-k <= k):
  print(0)
  exit()
  

def f(now, i):
 
  if(i==len(a)):
    if(now <= k):
      return 0
    #print(now)
    return 1
    
  count = 0
  aa = 1
  for j in range(a[i][1]+1):
    count += f(now*aa, i+1)
    aa*=a[i][0]
  return count
    
    
ans = f(1, 0)

print(ans)
0