标签:
Time Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3581 Accepted Submission(s): 1196
int aa[maxn]; set<int> kiss; int n; void dfs(int a,int b,int c,int d) { if(d==n) { if(a*b*c*d==0) return; if(a+b>c&&a<=b&&b<=c) { kiss.insert(a*1000010000+b*10000+c); } return; } dfs(a+aa[d],b,c,d+1); dfs(a,b+aa[d],c,d+1); dfs(a,b,c+aa[d],d+1); } int main() { int t; RD(t); while(t--) { kiss.clear(); RD(n); REP(i,n) { RD(aa[i]); } dfs(0,0,0,0); cout<<kiss.size()<<endl; } }
标签:
原文地址:http://www.cnblogs.com/qscqesze/p/4332166.html