#include #include #define swap(type,x,y) do{type t=x;x=y;y=t;}while(0) void bubble(int *W,int N) { int i,j; for(i=0;ii;j--) if(W[j-1]>W[j]){ swap(int,W[j-1],W[j]); exchg++; } if(exchg==0)break; } } int count(int *W,int L,int cnt) { int i; for(i=0,cnt=0;L>0;i++){ L-=W[i]; cnt++; if(L-W[i+1]<0) break; } return cnt; } int main(void) { int i,cnt=0; int L,N; int *W; scanf("%d%d",&L,&N); W=calloc(N,sizeof(int)); for(i=0;i