比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
AAWWAWAAAE |
题目名称 |
Asm.Def的枪榴弹 |
最终得分 |
60 |
用户昵称 |
zjh001 |
运行时间 |
0.095 s |
代码语言 |
C |
内存使用 |
3.04 MiB |
提交时间 |
2015-10-31 11:30:42 |
显示代码纯文本
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define oo 0x7fffffff
int n;
int a[30],b[30],c[30],d[30],e[30];
int f[30][30][30][30];
int k1,k2,k3,sum=-oo;
int max(int a,int b)
{return a>b?a:b;}
int find(int t0,int t1,int t2,int num)
{
if (f[t0][t1][t2][num]!=0) return f[t0][t1][t2][num];
if (num>=n)
return t0+t1+t2;
else
{
int i,t=-oo;
for (i=num+1;i<=n+1;i++)
{
if (t0>=a[i] && t1>=b[i])
{
t=max(find(t0-a[i]+c[i],t1-b[i]+d[i],t2+e[i],i),t);
}
if (t0<a[i] && t1>=b[i] && t0+t2>=a[i])
{
t=max(find(c[i],t1-b[i]+d[i],t2-(a[i]-t0)+e[i],i),t);
}
if (t0>=a[i] && t1<b[i] && t1+t2>=b[i])
{
t=max(find(t0-a[i]+c[i],d[i],t2-(b[i]-t1)+e[i],i),t);
}
if (t0<a[i] && t1<b[i] && t0+t1+t2>=a[i]+b[i])
{
t=max(find(c[i],d[i],t2-(a[i]+b[i]-t0-t1)+e[i],i),t);
}
}
return f[t0][t1][t2][num]=t;
}
}
int main()
{
int i,j;
freopen("asm_grenade.in","r",stdin);
freopen("asm_grenade.out","w",stdout);
scanf ("%d",&n);
for (i=1;i<=n;i++)
scanf ("%d",&a[i]);
for (i=1;i<=n;i++)
scanf ("%d",&b[i]);
for (i=1;i<=n;i++)
scanf ("%d",&c[i]);
for (i=1;i<=n;i++)
scanf ("%d",&d[i]);
for (i=1;i<=n;i++)
scanf ("%d",&e[i]);
scanf ("%d%d%d",&k1,&k2,&k3);
printf ("%d\n",find(k1,k2,k3,0));
return 0;
}