/* Question: give a few numbers as weights to see which cannot be claimed. Solution: first, find all the situations that can be added to the backpack, and then brute force find out the situations where subtraction can be used. When the variable I and j are put out, it will time out .... Thank you, Gigi. */# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> using namespace STD; int DP [11002]; int vis [11002]; int XX [11002]; int res [11002]; int A [112], sum, N, T; void onepack (INT cost, int weight) {int L; for (L = sum; L> = cost; l --) if (DP [l] <DP [L-cost] + weight) DP [l] = DP [L-cost] + weight;} int main () {int I, j; // timeout will occur when it is put out. Thank you for choosing Gigi. While (~ Scanf ("% d", & N) {memset (DP, 0, sizeof (DP); memset (VIS, 0, sizeof (VIS); sum = 0; for (I = 0; I <n; I ++) {scanf ("% d", & A [I]); sum + = A [I];} for (I = 0; I <n; I ++) onepack (A [I], a [I]); for (I = 1; I <= sum; I ++) vis [DP [I] = 1; t =-1; for (I = 1; I <= sum; I ++) if (vis [I]) xx [++ T] = I; for (I = 0; I <= T; I ++) for (j = I + 1; j <= T; j ++) vis [XX [J]-XX [I] = 1; t = 0; for (I = 1; I <= sum; I ++) if (! Vis [I]) {res [++ T] = I;} printf ("% d \ n", T); If (T> 0) {for (I = 1; I <t; I ++) printf ("% d", Res [I]); printf ("% d \ n ", res [T]) ;}} return 0 ;}