結果

問題 No.2766 Delicious Multiply Spice
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2024-05-31 21:35:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 509 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 259,228 KB
最終ジャッジ日時 2024-05-31 21:35:23
合計ジャッジ時間 5,255 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
60,372 KB
testcase_01 AC 41 ms
53,172 KB
testcase_02 AC 39 ms
53,356 KB
testcase_03 AC 41 ms
52,828 KB
testcase_04 AC 40 ms
53,000 KB
testcase_05 AC 40 ms
53,304 KB
testcase_06 AC 41 ms
52,524 KB
testcase_07 AC 43 ms
52,932 KB
testcase_08 AC 40 ms
52,460 KB
testcase_09 AC 40 ms
52,628 KB
testcase_10 AC 41 ms
52,392 KB
testcase_11 AC 52 ms
61,980 KB
testcase_12 AC 51 ms
62,012 KB
testcase_13 AC 63 ms
67,924 KB
testcase_14 AC 40 ms
53,352 KB
testcase_15 AC 43 ms
52,700 KB
testcase_16 AC 40 ms
52,204 KB
testcase_17 AC 40 ms
53,032 KB
testcase_18 AC 41 ms
53,660 KB
testcase_19 AC 143 ms
86,948 KB
testcase_20 AC 109 ms
80,536 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def find_op(N):
    dp = {1: ""}
    
    for i in range(2, N + 1):
        options = []
        
        if (i - 1) % 2 == 0:
            prev = (i - 1) // 2
            if prev in dp:
                options.append(dp[prev] + 'A')
        
        if (i - 1) % 3 == 0:
            prev = (i - 1) // 3
            if prev in dp:
                options.append(dp[prev] + 'B')

        if options:
            dp[i] = min(options, key=len)

    return dp[N]
N = int(input())
result = find_op(N)
print(result) 
0