結果

問題 No.392 2分木をたどれ
ユーザー gu_21816943gu_21816943
提出日時 2017-06-27 23:51:13
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 3,632 ms
コンパイル使用メモリ 72,196 KB
実行使用メモリ 57,508 KB
最終ジャッジ日時 2023-07-27 16:19:16
合計ジャッジ時間 4,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);

	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());
			len(point);
			out.println();
		}
		br.close();
		out.flush();

	}

	public static int len(int point) {
		if (point == 0) {
			return 0;
		} else {
			if (point % 2 == 0) {
				out.print("R");
				return len((point - 1) / 2);
			} else {
				out.print("L");
				return len(point / 2);
			}
		}
	}
}
0