結果

問題 No.688 E869120 and Constructing Array 2
ユーザー tailstails
提出日時 2018-05-18 22:41:16
言語 Perl
(5.38.2)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 191 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 4,640 KB
最終ジャッジ日時 2023-09-21 19:55:57
合計ジャッジ時間 942 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,592 KB
testcase_01 AC 3 ms
4,532 KB
testcase_02 AC 2 ms
4,548 KB
testcase_03 AC 3 ms
4,476 KB
testcase_04 AC 2 ms
4,580 KB
testcase_05 AC 3 ms
4,496 KB
testcase_06 AC 3 ms
4,448 KB
testcase_07 AC 2 ms
4,560 KB
testcase_08 AC 2 ms
4,476 KB
testcase_09 AC 2 ms
4,580 KB
testcase_10 AC 3 ms
4,608 KB
testcase_11 AC 3 ms
4,592 KB
testcase_12 AC 2 ms
4,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$k=<>;
if($k==0){
	print"1\n0";
	exit;
}
while(!($k&1)){
	$k>>=1;
	++$a;
}
while(1){
	$b=int sqrt$k*2;
	if($k==$b*($b+1)/2){
		print$a+$b+1,$/,"0 "x$a,"1 "x$b,1;
		exit;
	}
	$k<<=1;
	--$a;
}
0