题见计蒜客 挺有意思的
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int n,l,tot=0,a[30],m[30],f=0;
void dfs(int p,int g,int len){
if(!f) {
if(g==3) {
f=1;return;
}
if(len==l){
g++;
len=0;
p=0;
}
for(int i=p;i<n;i++){
if(!m[i]&&a[i]+len<=l){
m[i]=1;
dfs(i,g,len+a[i]);
m[i]=0;
}
}
}
}
int main() {
cin>>n;
for(int i=0;i<n;i++) {
cin>>a[i];
tot+=a[i];
}
l=tot/4;
int fl=0;
for(int i=0;i<n;i++)
if (a[i]>l) f=1;
if(tot%4!=0||f) cout<<"No";
else{
dfs(0,0,0);
if(f) cout<<"Yes";
else cout<<"No";
}
return 0;
}