結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2020-05-06 21:32:03 |
言語 | Python3 (3.10.1 + numpy 1.22.3 + scipy 1.8.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 331 bytes |
コンパイル時間 | 63 ms |
使用メモリ | 7,872 KB |
最終ジャッジ日時 | 2023-02-04 10:27:53 |
合計ジャッジ時間 | 856 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,684 KB |
testcase_01 | AC | 30 ms
7,864 KB |
testcase_02 | AC | 30 ms
7,872 KB |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() m=int(input()) def ans(x): n=len(str(bin(x)))-2 if x==2**n-1: return "L"*n else: ret="" x+=1 for s in str(bin(x))[3:][::-1]: if s=="0": ret+="L" else: ret+="R" return ret[::-1] for _ in range(m): print(ans(int(input())))