标签:+= clu cpp include cst tor tps map class
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<map>
using namespace std;
int s[5],ans[5]={9999,9999,9999,9999,9999},l,r;
int w[5][30],b[5][30];
void dfs(int p,int no)
{
if(no>s[p])
{
ans[p]=min(ans[p],max(l,r));
return;
}
l+=w[p][no];dfs(p,no+1);l-=w[p][no];
r+=w[p][no];dfs(p,no+1);r-=w[p][no];
}
int main()
{
cin>>s[1]>>s[2]>>s[3]>>s[4];
for(int k=1;k<=4;k++)
for(int i=1;i<=s[k];i++)
cin>>w[k][i];
for(int k=1;k<=4;k++)
{
l=r=0;
dfs(k,1);
}
cout<<ans[1]+ans[2]+ans[3]+ans[4];
return 0;
}
标签:+= clu cpp include cst tor tps map class
原文地址:https://www.cnblogs.com/gongdakai/p/13199357.html