結果

問題 No.847 Divisors of Power
ユーザー mkawa2mkawa2
提出日時 2019-07-05 22:26:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 103,028 KB
最終ジャッジ日時 2024-04-16 07:43:05
合計ジャッジ時間 7,466 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
11,008 KB
testcase_01 AC 35 ms
10,880 KB
testcase_02 AC 34 ms
10,880 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 33 ms
10,880 KB
testcase_05 AC 39 ms
10,880 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 33 ms
10,752 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 33 ms
10,752 KB
testcase_11 AC 34 ms
10,880 KB
testcase_12 AC 32 ms
10,880 KB
testcase_13 AC 34 ms
10,880 KB
testcase_14 AC 33 ms
10,880 KB
testcase_15 TLE -
testcase_16 AC 32 ms
10,880 KB
testcase_17 AC 31 ms
10,752 KB
testcase_18 AC 36 ms
11,008 KB
testcase_19 AC 52 ms
12,160 KB
testcase_20 AC 35 ms
10,880 KB
testcase_21 AC 585 ms
33,932 KB
testcase_22 AC 34 ms
10,880 KB
testcase_23 AC 36 ms
10,752 KB
testcase_24 TLE -
testcase_25 AC 32 ms
11,008 KB
testcase_26 AC 30 ms
11,136 KB
testcase_27 AC 36 ms
11,008 KB
testcase_28 AC 31 ms
11,136 KB
testcase_29 AC 30 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
n,k,m=map(int,input().split())
if n==1:
    print(1)
    exit()
tei=[]
sis=[]
cnt=0
while n%2==0:
    n//=2
    cnt+=1
if cnt:
    tei=[2]
    sis=[cnt*k]
i=3
while i**2<=n:
    cnt=0
    while n%i==0:
        cnt+=1
        n//=i
    if cnt:
        tei+=[i]
        sis+=[cnt*k]
    i+=2
if n>1:
    tei+=[n]
    sis+=[k]
#print(sis)
#print(tei)
kos=len(tei)
hp=[]
a=[0]*kos
heappush(hp,[1]+a)
used=set()
used.add(tuple(a))
cnt=0
while 1:
    y,*a=heappop(hp)
    if y>m:break
    for i in range(kos):
        if a[i]==sis[i]:continue
        ny=y*tei[i]
        na=a[:]
        na[i]+=1
        ta=tuple(na)
        if ta in used:continue
        heappush(hp,[ny]+na)
        used.add(ta)
    cnt+=1
print(cnt)
0