結果

問題 No.2766 Delicious Multiply Spice
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-06-01 03:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 82,704 KB
実行使用メモリ 53,972 KB
最終ジャッジ日時 2024-06-01 03:41:21
合計ジャッジ時間 3,554 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,996 KB
testcase_01 AC 40 ms
52,068 KB
testcase_02 AC 40 ms
52,436 KB
testcase_03 AC 38 ms
52,836 KB
testcase_04 AC 39 ms
53,660 KB
testcase_05 AC 38 ms
53,024 KB
testcase_06 AC 41 ms
53,636 KB
testcase_07 AC 41 ms
52,696 KB
testcase_08 AC 38 ms
52,668 KB
testcase_09 AC 38 ms
52,376 KB
testcase_10 AC 39 ms
52,548 KB
testcase_11 AC 38 ms
52,944 KB
testcase_12 AC 39 ms
52,008 KB
testcase_13 AC 39 ms
52,888 KB
testcase_14 AC 40 ms
53,196 KB
testcase_15 AC 39 ms
51,760 KB
testcase_16 AC 40 ms
53,216 KB
testcase_17 AC 39 ms
52,624 KB
testcase_18 AC 40 ms
52,068 KB
testcase_19 AC 40 ms
53,972 KB
testcase_20 AC 41 ms
52,708 KB
testcase_21 AC 40 ms
52,480 KB
testcase_22 AC 39 ms
52,068 KB
testcase_23 AC 39 ms
52,224 KB
testcase_24 AC 39 ms
52,088 KB
testcase_25 AC 39 ms
52,108 KB
testcase_26 AC 42 ms
52,936 KB
testcase_27 AC 39 ms
53,208 KB
testcase_28 AC 39 ms
52,192 KB
testcase_29 AC 40 ms
52,408 KB
testcase_30 AC 39 ms
52,812 KB
testcase_31 AC 41 ms
52,276 KB
testcase_32 AC 40 ms
52,996 KB
testcase_33 AC 40 ms
52,288 KB
testcase_34 AC 40 ms
52,836 KB
testcase_35 AC 38 ms
52,816 KB
testcase_36 AC 39 ms
52,192 KB
testcase_37 AC 40 ms
53,424 KB
testcase_38 AC 40 ms
52,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

def dfs(n):
  if n==1:
    return 1,""
  if (n-1)%2==0:
    f,s=dfs((n-1)//2)
    if f:
      return 1,s+"A"
  if (n-1)%3==0:
    f,s=dfs((n-1)//3)
    if f:
      return 1,s+"B"
  return 0,""

print(dfs(n)[1])
0