結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-09-19 14:48:12 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 286 ms / 2,000 ms |
| コード長 | 622 bytes |
| コンパイル時間 | 2,015 ms |
| コンパイル使用メモリ | 74,340 KB |
| 実行使用メモリ | 47,572 KB |
| 最終ジャッジ日時 | 2024-07-18 08:15:02 |
| 合計ジャッジ時間 | 3,011 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int m = scan.nextInt();
int[]A = new int[m];
for(int i = 0; i < m; i++) {
A[i] = scan.nextInt();
}
scan.close();
StringBuilder[] sb = new StringBuilder[m];
for(int i = 0; i < m; i++) {
int t = A[i];
sb[i] = new StringBuilder();
while(t != 0) {
if(t % 2 == 0) {
sb[i].append("R");
t = t / 2 - 1;
}else {
sb[i].append("L");
t = t / 2;
}
}
}
for(int i = 0; i < m; i++) {
System.out.println(sb[i].reverse().toString());
}
}
}
YamaKasa