結果

問題 No.2868 Another String of yuusaan
ユーザー gew1fw
提出日時 2025-06-12 19:28:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 909 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 214,596 KB
最終ジャッジ日時 2025-06-12 19:28:47
合計ジャッジ時間 3,810 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N, K = map(int, input().split())
    s = "yuusaan"
    while N > 1:
        part_length = 7 ** (N - 1)
        boundaries = [
            1,
            1 + part_length,
            1 + 2 * part_length,
            2 + 2 * part_length,
            2 + 3 * part_length,
            2 + 4 * part_length,
            3 + 4 * part_length
        ]
        part = 6  # default to last part if not found
        for i in range(7):
            if K <= boundaries[i]:
                part = i
                break
        if part in [0, 3, 6]:
            print(s[part])
            return
        else:
            if part == 1:
                K -= boundaries[0]
            elif part == 2:
                K -= boundaries[1]
            elif part == 4:
                K -= boundaries[3]
            elif part == 5:
                K -= boundaries[4]
            N -= 1
    print(s[K-1])

solve()
0