結果

問題 No.2365 Present of good number
ユーザー miho-4miho-4
提出日時 2023-06-30 22:34:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 75,908 KB
最終ジャッジ日時 2023-09-21 16:43:32
合計ジャッジ時間 5,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,164 KB
testcase_01 AC 72 ms
71,464 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 77 ms
75,668 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 71 ms
71,280 KB
testcase_18 AC 72 ms
71,396 KB
testcase_19 WA -
testcase_20 AC 72 ms
71,372 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#from collections import defaultdict
n,K=map(int,input().split())
mod=10**9+7
d=dict()
i=2
while 1<n:
  while n%i==0:
    n//=i
    if i in d:d[i]+=1
    else:d[i]=1
  i+=1
  
L=[[k,v] for k,v in d.items()]

for i in range(1,K+1):
  nx=dict()
  if 2 in d:
    nx[3]=d[2]
  for k,v in d.items():
    if k==2:continue
    else:
      if (k+1)//2 in nx:nx[(k+1)//2]+=d[k]
      else:nx[(k+1)//2]=d[k]
      if 2 in nx:nx[2]+=d[k]
      else:nx[2]=d[k]
  d=nx
  if len(d)<=2 and set(list(d.keys())) in [{2,3},{2},{3}] :
    if 2 in d:d[2]*=pow(2,(K-i)//2,mod)
    if 3 in d:d[3]*=pow(2,(K-i)//2,mod)
    if (K-i)%2==1:
      nx=dict()
      if 3 in d:nx[2]=d[3]*2
      if 2 in d:nx[3]=d[2]
    break

ans=1
for k,v in nx.items():
  ans*=pow(k,v,mod)
  ans%=mod
print(ans)
0