/* Use a weight scale to calculate the weight. The weight value can be negative Based on the right code of the left object. Because the maximum weight is one,
Therefore, you are not allowed to use k in a general template as a heavy loop. The number of de-weights is 0, and the number of values is 1. Open
I thought wrong when I first took the negative weight. Wa has been used several times... T_t */
// My code:
# Include <iostream>
# Include <cstdio>
# Include <cstring>
Using Namespace STD;
Const Int N =10007 ;
Int C1 [N], C2 [N];
Int Val [ 107 ];
Int Main (){
// Freopen ("data. In", "r", stdin );
Int N, S, I, j, TMP, CNT;
While (~ Scanf ( " % D " , & N )){
Memset (C1, 0 , Sizeof (C1 ));
Memset (C2, 0 , Sizeof (C2 ));
Memset (Val, 0 , Sizeof (VAL ));
For (S = 0 , I = 1 ; I <= N; ++ I ){
Scanf (" % D " , & Val [I]);
S + = Val [I];
}
C1 [ 0 ] = 1 ; C1 [Val [ 1 ] = 1 ;
For (I = 2 ; I <= N; ++ I ){
For (J = 0 ; J + val [I] <= s; ++ J ){
If (C1 [J]! = 0 ){
C2 [J] + = c1 [J];
C2 [J + val [I] + = c1 [J];
TMP = J-Val [I]; // Wa several times...
TMP = TMP> 0 ? TMP :- 1 * TMP;
C2 [TMP] + = c1 [J];
}
}
For (J = 0 ; J <= s; ++ J ){
C1 [J] = c2 [J]; c2 [J] = 0 ;
}
}
For (CNT = 0 , I = 0 ; I <= s; ++ I ){
If (! C1 [I]) CNT ++;
}
Printf ( " % D \ n " , CNT );
For (J =0 , I = 0 ; I <= S & J <= CNT; ++ I ){
If (! C1 [I]) {
Printf ( " % D " , I); ++ J;
If (J = CNT) putchar ( ' \ N ' );
Else Putchar ( ' ' );
}
}
}
Return 0 ;
}