結果

問題 No.688 E869120 and Constructing Array 2
ユーザー YamaKasaYamaKasa
提出日時 2018-05-18 23:08:27
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 855 bytes
コンパイル時間 2,137 ms
コンパイル使用メモリ 74,776 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2023-09-21 20:03:07
合計ジャッジ時間 6,217 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 126 ms
55,708 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long K = scan.nextInt();
		scan.close();
		int index1 = 2;
		int index2 = 0;
		int flag = 0;
		for(int i = 2; i < 30; i++) {
			long x = i * (i - 1);
			index1 = i;
			for(int j = 0; j < 30 - i; j++) {
				long y;
				y = (long)Math.pow(2, j);
				if(x * y == 2 * K) {
					index2 = j;
					flag = 1;
					break;
				}
			}
			if(flag == 1) {
				break;
			}
		}
		for(int i = 0; i < index1; i++) {
			if(i == index1 - 1) {
				System.out.print(1);
			}else {
				System.out.print(1 + " ");
			}
		}
		for(int i = 1; i < index2; i++) {
			if(i == 1) {
				System.out.print(" " + 0 + " ");
			}
			if(i == index2 - 1) {
				System.out.print(0);
			}else {
				System.out.print(0 + " ");
			}
		}
		System.out.println();
	}
}
0