結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2017-06-27 23:54:46 |
言語 | Java19 (openjdk 19.0.1) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 2,153 ms |
コンパイル使用メモリ | 83,076 KB |
実行使用メモリ | 58,280 KB |
最終ジャッジ日時 | 2023-07-27 16:19:19 |
合計ジャッジ時間 | 3,041 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
49,784 KB |
testcase_01 | AC | 136 ms
58,280 KB |
testcase_02 | AC | 134 ms
58,140 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; class Main { static PrintWriter out = new PrintWriter(System.out); static String str; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num = Integer.parseInt(br.readLine()); int point; for (int i = 0; i < num; i++) { point = Integer.parseInt(br.readLine()); str=""; len(point); out.println(str); } br.close(); out.flush(); } public static int len(int point) { if (point == 0) { return 0; } else { if (point % 2 == 0) { str="R"+str; return len((point - 1) / 2); } else { str="L"+str; return len(point / 2); } } } }