結果

問題 No.392 2分木をたどれ
ユーザー GrayCoderGrayCoder
提出日時 2018-08-12 19:13:05
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 64 ms
使用メモリ 8,148 KB
最終ジャッジ日時 2022-11-23 02:35:42
合計ジャッジ時間 964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,684 KB
testcase_01 AC 26 ms
8,148 KB
testcase_02 AC 26 ms
8,108 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