记录编号 |
205413 |
评测结果 |
AWWTWWWWWW |
题目名称 |
不平凡的boss |
最终得分 |
10 |
用户昵称 |
FETS 1/3 |
是否通过 |
未通过 |
代码语言 |
C++ |
运行时间 |
1.567 s |
提交时间 |
2015-11-05 12:16:58 |
内存使用 |
1.17 MiB |
显示代码纯文本
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int maxn=100050;
int n;
int a[maxn];
int b[maxn];
int c[maxn];
int minn=100000005;
void dfs(int x,int aa,int bb,int cc)
{
if(x==n+1)
{
minn=min(aa+bb+cc,minn);
return;
}
for(int i=1;i<=3;i++)
{
if(i==1)
{
if(a[x]-aa+bb+cc<minn)
dfs(x+1,a[i],bb,cc);
}
if(i==2)
{
if(b[x]-bb+aa+cc<minn)
dfs(x+1,aa,b[i],cc);
}
if(i==3)
{
if(c[x]-cc+aa+bb<minn)
dfs(x+1,aa,bb,c[i]);
}
}
}
int main()
{
freopen("playwithboss.in","r",stdin);
freopen("playwithboss.out","w",stdout);
int maxx=-1;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d %d %d",&a[i],&b[i],&c[i]);
maxx=max(max(c[i],max(a[i],b[i])),maxx);
}
minn=maxx;
dfs(1,0,0,0);
printf("%d",minn+1);
}