結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-19 22:13:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 170 ms / 2,000 ms |
| コード長 | 634 bytes |
| コンパイル時間 | 3,874 ms |
| コンパイル使用メモリ | 74,528 KB |
| 実行使用メモリ | 40,488 KB |
| 最終ジャッジ日時 | 2024-11-27 06:20:53 |
| 合計ジャッジ時間 | 3,731 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
while (n > 0) {
int tar = Integer.parseInt(br.readLine());
int x = 0;
int h = 0;
int w = 1;
while (x < tar) {
h++;
w *= 2;
x += w;
}
tar = tar + w - x;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < h; i++) {
w /= 2;
if (tar > w) {
sb.append("R");
tar -= w;
} else {
sb.append("L");
}
}
System.out.println(sb);
n--;
}
}
}