結果

問題 No.617 Nafmo、買い出しに行く
ユーザー tailstails
提出日時 2017-12-17 00:03:56
言語 Perl
(5.38.2)
結果
AC  
実行時間 674 ms / 2,000 ms
コード長 160 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 5,340 KB
最終ジャッジ日時 2023-08-21 11:37:51
合計ジャッジ時間 7,944 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,168 KB
testcase_01 AC 6 ms
5,340 KB
testcase_02 AC 7 ms
5,300 KB
testcase_03 AC 47 ms
5,216 KB
testcase_04 AC 6 ms
5,208 KB
testcase_05 AC 89 ms
5,084 KB
testcase_06 AC 673 ms
5,168 KB
testcase_07 AC 672 ms
5,168 KB
testcase_08 AC 6 ms
5,164 KB
testcase_09 AC 5 ms
5,200 KB
testcase_10 AC 673 ms
5,200 KB
testcase_11 AC 673 ms
5,200 KB
testcase_12 AC 673 ms
5,304 KB
testcase_13 AC 674 ms
5,172 KB
testcase_14 AC 673 ms
5,160 KB
testcase_15 AC 649 ms
5,168 KB
testcase_16 AC 649 ms
5,204 KB
testcase_17 AC 649 ms
5,204 KB
testcase_18 AC 6 ms
5,080 KB
testcase_19 AC 6 ms
5,080 KB
testcase_20 AC 6 ms
5,200 KB
testcase_21 AC 6 ms
5,204 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::n" used only once: possible typo at Main.pl line 1.
Main.pl syntax OK

ソースコード

diff #

($n,$k)=glob<>;
@a=<>;
sub f{
	my($i,$s)=@_;
	if($i>=@a){
		if($s<=$k&&$b<$s){
			$b=$s;
		}
	}else{
		f($i+1,$s+$a[$i]);
		f($i+1,$s);
	}
}
f(0,0);
print$b+0;
0