結果

問題 No.5 数字のブロック
ユーザー kotatsugamekotatsugame
提出日時 2016-10-25 00:37:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 280 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 65,396 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-11-24 03:29:07
合計ジャッジ時間 127,066 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 TLE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<algorithm>
using namespace std;
int w[10000];
int l,n;

int s(int le,int a)
{
	if(le<0)return -1;
	if(a>=n)return 0;
	return max(s(le-w[a],a+1)+1,s(le,a+1));
}

int main() {
	cin>>l>>n;
	for(int i=0;i<n;i++)cin>>w[i];
	cout<<s(l,0)<<endl;
	return 0;
}
0