結果

問題 No.2766 Delicious Multiply Spice
ユーザー KDKJKDKJ
提出日時 2024-05-31 21:38:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 1,092 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,020 KB
実行使用メモリ 89,328 KB
最終ジャッジ日時 2024-05-31 21:39:09
合計ジャッジ時間 8,066 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
89,148 KB
testcase_01 AC 175 ms
88,932 KB
testcase_02 AC 176 ms
88,940 KB
testcase_03 AC 148 ms
89,224 KB
testcase_04 AC 147 ms
89,328 KB
testcase_05 AC 177 ms
88,892 KB
testcase_06 AC 145 ms
88,908 KB
testcase_07 AC 146 ms
89,036 KB
testcase_08 AC 146 ms
89,320 KB
testcase_09 AC 177 ms
89,128 KB
testcase_10 AC 148 ms
88,980 KB
testcase_11 AC 146 ms
88,820 KB
testcase_12 AC 147 ms
88,828 KB
testcase_13 AC 146 ms
89,040 KB
testcase_14 AC 162 ms
89,120 KB
testcase_15 AC 150 ms
89,280 KB
testcase_16 AC 150 ms
88,900 KB
testcase_17 AC 145 ms
89,184 KB
testcase_18 AC 146 ms
88,952 KB
testcase_19 AC 170 ms
89,104 KB
testcase_20 AC 148 ms
89,060 KB
testcase_21 AC 149 ms
89,228 KB
testcase_22 AC 147 ms
89,148 KB
testcase_23 AC 149 ms
88,912 KB
testcase_24 AC 146 ms
89,292 KB
testcase_25 AC 150 ms
89,172 KB
testcase_26 AC 149 ms
88,756 KB
testcase_27 AC 147 ms
88,932 KB
testcase_28 AC 162 ms
89,140 KB
testcase_29 AC 153 ms
88,964 KB
testcase_30 AC 147 ms
88,908 KB
testcase_31 AC 146 ms
89,092 KB
testcase_32 AC 151 ms
89,248 KB
testcase_33 AC 202 ms
88,976 KB
testcase_34 AC 163 ms
88,976 KB
testcase_35 AC 172 ms
89,144 KB
testcase_36 AC 149 ms
89,008 KB
testcase_37 AC 150 ms
89,124 KB
testcase_38 AC 148 ms
88,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify
from collections import defaultdict, deque,Counter
from math import ceil, floor, sqrt, factorial,gcd,cos,sin,pi
from itertools import permutations, combinations,product
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import Fraction
from random import randint
import sys
from functools import cache,lru_cache #@lru_cache(maxsize=None)
from time import time
#from sortedcontainers import SortedList # type: ignore
#sys.setrecursionlimit(10**6)
vector1 = [[0, -1], [1, 0], [0, 1], [-1, 0]]
vector2 = [[0, 1], [1, 0], [-1, 0], [0, -1],
           [1,-1], [-1, 1], [1, 1], [-1, -1]]
alphabet = "abcdefghijklmnopqrstuvwxyz"




def main():
    
    N = int(input())
    q = deque()
    q.append([N,""])
    
    while q:
        x,s = q.popleft()
        if x == 1:
            print(s[::-1])
        else:
            if (x - 1)%2 == 0:
                q.append([(x-1)//2,s + "A"])
            if (x - 1)%3 == 0:
                q.append([(x-1)//3,s + "B"])    
    
    

if __name__ == '__main__':
    main()


0