結果

問題 No.3 ビットすごろく
ユーザー %20%20
提出日時 2017-05-04 01:39:14
言語 Perl
(5.38.2)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 198 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 5,004 KB
最終ジャッジ日時 2023-09-14 00:41:03
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,592 KB
testcase_01 AC 2 ms
4,568 KB
testcase_02 AC 2 ms
4,688 KB
testcase_03 AC 5 ms
4,676 KB
testcase_04 AC 3 ms
4,496 KB
testcase_05 AC 9 ms
4,740 KB
testcase_06 AC 5 ms
4,588 KB
testcase_07 AC 4 ms
4,584 KB
testcase_08 AC 7 ms
4,712 KB
testcase_09 AC 10 ms
4,736 KB
testcase_10 AC 11 ms
4,828 KB
testcase_11 AC 10 ms
4,800 KB
testcase_12 AC 8 ms
4,864 KB
testcase_13 AC 5 ms
4,656 KB
testcase_14 AC 11 ms
4,768 KB
testcase_15 AC 13 ms
5,004 KB
testcase_16 AC 13 ms
4,852 KB
testcase_17 AC 14 ms
4,652 KB
testcase_18 AC 4 ms
4,644 KB
testcase_19 AC 14 ms
4,868 KB
testcase_20 AC 3 ms
4,484 KB
testcase_21 AC 2 ms
4,576 KB
testcase_22 AC 11 ms
4,924 KB
testcase_23 AC 13 ms
4,816 KB
testcase_24 AC 13 ms
4,872 KB
testcase_25 AC 14 ms
4,848 KB
testcase_26 AC 2 ms
4,480 KB
testcase_27 AC 5 ms
4,596 KB
testcase_28 AC 13 ms
4,812 KB
testcase_29 AC 10 ms
4,668 KB
testcase_30 AC 3 ms
4,584 KB
testcase_31 AC 3 ms
4,404 KB
testcase_32 AC 9 ms
4,624 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$N=<>;
$d[@q=1]=2;
while($i=shift@q){
	$t=0;
	$t+=$i>>$_&1for 0..13;
	if($i-$t>=1){
		$d[$i-$t]||=$d[$i]+!!(push@q,$i-$t)
	}
	if($i+$t<=$N){
		$d[$i+$t]||=$d[$i]+!!(push@q,$i+$t)
	}
}
print$d[$N]-1
0