結果

問題 No.392 2分木をたどれ
ユーザー htensai
提出日時 2020-01-26 09:38:05
言語 Java
(openjdk 23)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 2,284 ms
コンパイル使用メモリ 75,016 KB
実行使用メモリ 46,000 KB
最終ジャッジ日時 2024-09-14 10:51:18
合計ジャッジ時間 3,313 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            StringBuilder tmp = new StringBuilder();
            int x = sc.nextInt() + 1;
            while (x > 1) {
                if (x % 2 == 0) {
                    tmp.append("L");
                } else {
                    tmp.append("R");
                }
                x /= 2;
            }
            tmp.reverse();
            sb.append(tmp).append("\n");
        }
        System.out.print(sb);
    }
}
0