锘??xml version="1.0" encoding="utf-8" standalone="yes"?> c.assign(n,elem) c.erase(beg,end) c.insert(pos,n,elem) c.insert(pos,beg,end)
c.assign(beg,end)
灝哰beg; end)鍖洪棿涓殑鏁版嵁璧嬪肩粰c銆?
灝唍涓猠lem鐨勬嫹璐濊祴鍊肩粰c銆?br>
c.at(idx)
浼犲洖绱㈠紩idx鎵鎸囩殑鏁版嵁錛屽鏋渋dx瓚婄晫錛屾姏鍑簅ut_of_range銆?br>
c.back()
浼犲洖鏈鍚庝竴涓暟鎹紝涓嶆鏌ヨ繖涓暟鎹槸鍚﹀瓨鍦ㄣ?br>
c.begin()
浼犲洖榪唬鍣ㄤ腑鐨勪竴涓暟鎹?br>
c.capacity()
榪斿洖瀹瑰櫒涓暟鎹釜鏁般?br>
c.clear()
縐婚櫎瀹瑰櫒涓墍鏈夋暟鎹?br>
c.empty()
鍒ゆ柇瀹瑰櫒鏄惁涓虹┖銆?br>
c.end()
鎸囧悜榪唬鍣ㄤ腑鐨勬渶鍚庝竴涓暟鎹湴鍧銆?br>
c.erase(pos)
鍒犻櫎pos浣嶇疆鐨勬暟鎹紝浼犲洖涓嬩竴涓暟鎹殑浣嶇疆銆?/p>
鍒犻櫎[beg,end)鍖洪棿鐨勬暟鎹紝浼犲洖涓嬩竴涓暟鎹殑浣嶇疆銆?br>
c.front()
浼犲洖鍦頒竴涓暟鎹?br>
get_allocator
浣跨敤鏋勯犲嚱鏁拌繑鍥炰竴涓嫹璐濄?br>
c.insert(pos,elem)
鍦╬os浣嶇疆鎻掑叆涓涓猠lem鎷瘋礉錛屼紶鍥炴柊鏁版嵁浣嶇疆銆?/p>
鍦╬os浣嶇疆鎻掑叆n涓猠lem鏁版嵁銆傛棤榪斿洖鍊箋?/p>
鍦╬os浣嶇疆鎻掑叆鍦╗beg,end)鍖洪棿鐨勬暟鎹傛棤榪斿洖鍊箋?br>
c.max_size()
榪斿洖瀹瑰櫒涓渶澶ф暟鎹殑鏁伴噺銆?br>
c.pop_back()
鍒犻櫎鏈鍚庝竴涓暟鎹?br>
c.push_back(elem)
鍦ㄥ熬閮ㄥ姞鍏ヤ竴涓暟鎹?br>
c.rbegin()
浼犲洖涓涓嗗悜闃熷垪鐨勭涓涓暟鎹?br>
c.rend()
浼犲洖涓涓嗗悜闃熷垪鐨勬渶鍚庝竴涓暟鎹殑涓嬩竴涓綅緗?br>
c.resize(num)
閲嶆柊鎸囧畾闃熷垪鐨勯暱搴︺?br>
c.reserve()
淇濈暀閫傚綋鐨勫閲忋?br>
c.size()
榪斿洖瀹瑰櫒涓疄闄呮暟鎹殑涓暟銆?br>
c1.swap(c2) swap(c1,c2)
灝哻1鍜宑2鍏冪礌浜掓崲銆?/p>
#include<iostream>
2
#include<algorithm>
3
#include<memory.h>
4
#include<ctime>
5
using namespace std;
6
int n; //灝忔鎬繪暟
7
int len; //褰撳墠鏋氫婦鐨勫師媯掗暱搴?/span>
8
int parts; //褰撳墠緇勫悎鐨勫師媯掓暟
9
int max; //鏈闀垮皬媯掔殑闀垮害
10
int sum; //鎵鏈夊皬媯掔殑鎬婚暱
11
int a[100]; //瀛樺偍灝忔鐩稿叧淇℃伅
12
bool used[100]; //鏍囪灝忔鏄惁浣跨敤
13
14
15
bool pt(int a,int b)
16
{return a>b;}
17
bool dfs(int res,int cpl,int level)//res:褰撳墠宸茬粍鍚堣繘鍘葷殑鏈ㄦ鐨勯暱搴?nbsp; cpl:緇勫悎榪涘幓鐨勫皬鏈ㄦ鐨勬潯鏁?/span>
18

{
19
int i;
20
if(res==len)
21
{
22
res = 0;
23
cpl++;
24
}
25
if(cpl == parts)
26
return true;
27
for(i=level;i<n;i++)
28
{
29
if(i && !used[i-1] && a[i]==a[i-1])continue;
30
if(used[i]==0)
31
{
32
if(res + a[i] <len)
33
{
34
used[i] = true;
35
if(dfs(res+a[i],cpl,i+1))return true;
36
used[i] = false;
37
}
38
else if(res+a[i]==len)
39
{
40
used[i] = true;
41
if(dfs(0,cpl+1,0))return true;
42
used[i] = false;
43
}
44
if(res==0) break;
45
}
46
47
48
}
49
return false;
50
}
51
int main()
52

{
53
int i;
54
int T;
55
cin>>T;
56
while(T--)
{
57
scanf("%d",&n);
58
sum=0;
59
for(i=0;i<n;i++)
{
60
scanf("%d",&a[i]);
61
sum+=a[i];
62
used[i]=false;
63
}
64
sort(a,a+n,pt);
65
len=sum/4;
66
parts=4;
67
for(i=0;i<100;i++)
68
used[i]=false;
69
if(sum%4==0&&dfs(0,1,0))
70
{
71
printf("yes\n");
72
}
73
else printf("no\n");
74
}
75
return 0;
76
}
77
78
79
]]>
]]>