結果

問題 No.2766 Delicious Multiply Spice
ユーザー moon17moon17
提出日時 2024-05-31 23:09:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 54,284 KB
最終ジャッジ日時 2024-05-31 23:09:30
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,596 KB
testcase_01 AC 40 ms
52,864 KB
testcase_02 AC 40 ms
52,744 KB
testcase_03 AC 40 ms
53,020 KB
testcase_04 AC 40 ms
53,204 KB
testcase_05 AC 40 ms
52,312 KB
testcase_06 AC 40 ms
52,468 KB
testcase_07 AC 39 ms
52,132 KB
testcase_08 AC 40 ms
52,372 KB
testcase_09 AC 40 ms
51,996 KB
testcase_10 AC 41 ms
52,936 KB
testcase_11 AC 40 ms
53,296 KB
testcase_12 AC 41 ms
52,524 KB
testcase_13 AC 41 ms
52,432 KB
testcase_14 AC 40 ms
53,196 KB
testcase_15 AC 41 ms
53,008 KB
testcase_16 AC 40 ms
52,320 KB
testcase_17 AC 40 ms
53,408 KB
testcase_18 AC 40 ms
53,932 KB
testcase_19 AC 39 ms
53,000 KB
testcase_20 AC 39 ms
53,060 KB
testcase_21 AC 40 ms
52,532 KB
testcase_22 AC 39 ms
52,988 KB
testcase_23 AC 40 ms
53,172 KB
testcase_24 AC 40 ms
52,364 KB
testcase_25 AC 40 ms
52,312 KB
testcase_26 AC 41 ms
52,072 KB
testcase_27 AC 39 ms
52,616 KB
testcase_28 AC 41 ms
52,940 KB
testcase_29 AC 40 ms
52,676 KB
testcase_30 AC 41 ms
52,200 KB
testcase_31 AC 41 ms
53,668 KB
testcase_32 AC 39 ms
53,484 KB
testcase_33 AC 41 ms
52,528 KB
testcase_34 AC 41 ms
52,156 KB
testcase_35 AC 39 ms
53,196 KB
testcase_36 AC 39 ms
53,628 KB
testcase_37 AC 38 ms
52,816 KB
testcase_38 AC 39 ms
54,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
INF=1<<60
d={1:0,INF:INF}
def f(x):
  if x in d:
    return d[x]
  d[x]=INF
  if (x-1)%2==0:
    nx=(x-1)//2
    d[x]=min(d[x],f(nx)+1)
  if (x-1)%3==0:
    nx=(x-1)//3
    d[x]=min(d[x],f(nx)+1)
  return d[x]
f(n)
n=set()
c=[0]*(len(set(d.values()))-1)
for k,v in d.items():
  if v!=INF:
    c[v]=k
ans=[]
for i,j in zip(c,c[1:]):
  if i*2+1==j:
    ans+='A',
  else:
    ans+='B',
print(*ans,sep='')
0