結果

問題 No.392 2分木をたどれ
ユーザー hhgfhn1hhgfhn1
提出日時 2018-12-18 19:42:46
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 839 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 1,732 ms
使用メモリ 46,488 KB
最終ジャッジ日時 2022-11-24 07:12:07
合計ジャッジ時間 4,394 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 135 ms
42,724 KB
testcase_01 AC 813 ms
46,472 KB
testcase_02 AC 839 ms
46,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int m=scanner.nextInt();
		for(int i=0;i<m;i++) {
			int a=scanner.nextInt();
			dfs("",0,a);
		}
	}

	private static void dfs(String string, int i, int a) {
		if(i==a) {
			System.out.println(string);
			return;
		}
		else if(i>4094) {
			return;
		}
		dfs(string+"L",i*2+1,a);
		dfs(string+"R",i*2+2,a);
	}
}
0