結果

問題 No.2766 Delicious Multiply Spice
ユーザー hato336
提出日時 2024-05-31 21:37:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 85,916 KB
最終ジャッジ日時 2024-12-20 22:44:53
合計ジャッジ時間 7,419 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
n = int(input())
s = set()
def calc(x,seq):
    
    if x == 1:
        seq.reverse()
        exit(print(''.join(seq)))
        return
    elif x <= 0:
        return
    x -= 1
    if x % 2 == 0:
        calc(x//2,seq + ['A'])
    if x % 3 == 0:
        calc(x//3,seq + ['B'])
calc(n,[])
0