Last year, I get this question a good score $ 20 $ $ ovo .......... $
$Sol$
A pair now look actually very clear that, as long as it can be other number indicates the number of removed enough.
$ F [i] $ indicate whether $ i $ is represented by the number of other numbers. Complete backpack like spicy, but one thing different is that $ f [i] $ is the ability to be represented several other, not able to be represented put $ a [i] $ small to large, outermost loop to $ a [i] $ check $ f [i] $ $ 1 $ whether the cumulative answer.
$Code$
#include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<algorithm> #define il inline #define Rg register #define go(i,a,b) for(Rg int i=a;i<=b;++i) #define yes(i,a,b) for(Rg int i=a;i>=b;--i) #define mem(a,b) memset(a,b,sizeof(a)) #define ll long long #define db double #define inf 2147483647 using namespace std; il int read() { Rg int x=0,y=1;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();} while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();} return x*y; } int T,n,ms,as,a[110]; bool f[25010]; int main() { T=read(); while(T--) { n=read();go(i,1,n)a[i]=read(); sort(a+1,a+n+1); ms=a[n];as=0;mem(f,0); go(i,1,n) { if(f[a[i]])continue; as++,f[a[i]]=1; go(j,a[i],ms)if(f[j-a[i]])f[j]=1; } printf("%d\n",as); } return 0; }