結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-10-14 18:16:13 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 251 ms / 2,000 ms |
| コード長 | 615 bytes |
| コンパイル時間 | 2,278 ms |
| コンパイル使用メモリ | 74,900 KB |
| 実行使用メモリ | 45,604 KB |
| 最終ジャッジ日時 | 2024-07-20 19:14:56 |
| 合計ジャッジ時間 | 3,492 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
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++) {
int x = sc.nextInt();
StringBuilder tmp = new StringBuilder();
while (x > 0) {
if (x % 2 == 0) {
x--;
tmp.append("R");
} else {
tmp.append("L");
}
x /= 2;
}
sb.append(tmp.reverse()).append("\n");
}
System.out.print(sb);
}
}
tenten