結果
問題 | No.392 2分木をたどれ |
ユーザー | YamaKasa |
提出日時 | 2018-09-19 14:48:12 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 283 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 2,061 ms |
コンパイル使用メモリ | 71,672 KB |
実行使用メモリ | 60,672 KB |
最終ジャッジ日時 | 2023-09-25 10:08:52 |
合計ジャッジ時間 | 3,431 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
56,192 KB |
testcase_01 | AC | 282 ms
60,672 KB |
testcase_02 | AC | 283 ms
60,492 KB |
ソースコード
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()); } } }