Loading problem solving // #include <stdio.h> #define MAXN 20 is int n-, W is; int maxW; int X [MAXN]; int minm = 32767; void DISP (n-int) { int I; the printf ( "Selected Container: \ n-"); for (I =. 1; I <= n-; I ++) IF (X [I] ==. 1) the printf (" select.% d container \ n-", I); the printf (" total wt% D = \ n-", maxW); } void Loading (W int [], int TW, int m, OP int [], int i) {// i-th considered containers int J; IF (i> n- ) { IF (TW <= W is && (TW> maxW || (TW == maxW && m <minm))) { maxW = TW; minm = m; for (J =. 1; J <= n-; J ++) X [J] = OP [J]; } } the else { OP [I] =. 1; if(tw + w[i] <= W) Loading(w,tw+w[i],m+1,op,i+1); op[i] = 0; if(m <= 2) Loading(w,tw,m,op,i+1); } } int main(){ int w[] = {0,5,2,6,4,3}; int op[MAXN]; //存放临时解 n = 5,W = 10; Loading(w,0,0,op,1); disp(n); }