結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2017-12-17 00:03:56 |
| 言語 | Perl (5.40.0) |
| 結果 |
AC
|
| 実行時間 | 640 ms / 2,000 ms |
| コード長 | 160 bytes |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 5,760 KB |
| 実行使用メモリ | 6,016 KB |
| 最終ジャッジ日時 | 2024-12-14 22:28:36 |
| 合計ジャッジ時間 | 7,660 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
Name "main::n" used only once: possible typo at Main.pl line 1. Main.pl syntax OK
ソースコード
($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;
tails