結果

問題 No.847 Divisors of Power
ユーザー pluto77pluto77
提出日時 2022-02-12 10:57:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 8,300 KB
最終ジャッジ日時 2023-09-10 21:53:26
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 AC 16 ms
7,784 KB
testcase_06 AC 18 ms
7,852 KB
testcase_07 AC 18 ms
7,844 KB
testcase_08 AC 18 ms
7,792 KB
testcase_09 AC 17 ms
7,808 KB
testcase_10 AC 17 ms
7,868 KB
testcase_11 AC 18 ms
7,904 KB
testcase_12 AC 17 ms
7,796 KB
testcase_13 AC 18 ms
7,812 KB
testcase_14 AC 18 ms
7,848 KB
testcase_15 AC 94 ms
7,796 KB
testcase_16 AC 18 ms
7,808 KB
testcase_17 AC 19 ms
7,864 KB
testcase_18 AC 19 ms
7,792 KB
testcase_19 AC 20 ms
7,792 KB
testcase_20 AC 18 ms
7,956 KB
testcase_21 AC 41 ms
7,908 KB
testcase_22 AC 18 ms
7,920 KB
testcase_23 AC 18 ms
7,896 KB
testcase_24 AC 106 ms
7,904 KB
testcase_25 AC 18 ms
7,932 KB
testcase_26 AC 16 ms
7,896 KB
testcase_27 AC 18 ms
7,920 KB
testcase_28 AC 16 ms
7,860 KB
testcase_29 AC 16 ms
8,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki847
def prime_list(n,k):
 t=[]
 for i in range(2,int(n**0.5)+1):
  if n%i==0:
   cnt=0
   while n%i==0:
    cnt+=1
    n//=i
   t.append([i,cnt*k])
 if n>1:
  t.append([n,k])
 return t
 
def dfs(now,d):
 global res
 if p[d][1] and now*p[d][0]<=m:
  p[d][1]-=1
  res+=1
  dfs(now*p[d][0],d)
  p[d][1]+=1
 if d+1<len(p):
  dfs(now,d+1)

n,k,m=map(int,input().split())
if n==1:
 print(1)
 exit()
p=prime_list(n,k)
res=1
dfs(1,0)
print(res)
0