結果

問題 No.392 2分木をたどれ
ユーザー GrayCoderGrayCoder
提出日時 2018-08-12 19:13:05
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,968 KB
実行使用メモリ 10,332 KB
最終ジャッジ日時 2023-10-24 16:22:35
合計ジャッジ時間 796 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,052 KB
testcase_01 AC 40 ms
10,332 KB
testcase_02 AC 40 ms
10,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    M = int(input())
    A = [int(input()) for _ in [0] * M]

    for ai in A:
        ans = ''
        while ai > 0:
            if ai % 2:
                ans += 'L'
                ai = (ai * 2 + 1) // 4
            else:
                ans += 'R'
                ai = (ai * 2 - 1) // 4
        ans = ans[::-1]
        write(ans + '\n')

main()
0