比赛 |
20120710 |
评测结果 |
AAAAAATTTW |
题目名称 |
快餐问题 |
最终得分 |
60 |
用户昵称 |
czp |
运行时间 |
3.281 s |
代码语言 |
Pascal |
内存使用 |
2.19 MiB |
提交时间 |
2012-07-10 11:50:56 |
显示代码纯文本
var
a,b,c,i,j,n,p1,p2,p3,ans,d,l,k1,k2,k3,k,o1,o2,o3,pr1,pr2,pr3,pp1,pp2,pp3,bo,bi:longint;
v:array[1..10] of longint;
f:array[0..1,0..101,0..101,0..101] of boolean;
begin
assign(input,'meal.in');reset(input);
assign(output,'meal.out');rewrite(output);
readln(a,b,c);
readln(p1,p2,p3);
d:=a*p1+b*p2+c*p3;
readln(n);
for i:=1 to n do
begin
read(v[i]);
for j:=1 to 1000 do
if j*d>v[i] then break;
dec(j);
dec(v[i],j*d);
inc(ans,j);
end;
readln;
bo:=1;bi:=0;
f[bo,0,0,0]:=true;
pr1:=0;pr2:=0;pr3:=0;
for l:=1 to n do
begin
for i:=0 to 100 do
begin
if p1*i>v[l] then break;
for j:=0 to 100 do
begin
if p1*i+p2*j>v[l] then break;
k:=(v[l]-p1*i-p2*j) div p3;
for k1:=0 to 100 do
begin
if k1>pr1 then break;
for k2:=0 to 100 do
begin
if k2>pr2 then break;
for k3:=0 to 100 do
begin
if k3>pr3 then break;
if (f[bo,k1,k2,k3]) then
begin
f[bi,k1,k2,k3]:=true;
if (k1+i<=100)and(k2+j<=100)and(k3+k<=100)then begin
f[bi,k1+i,k2+j,k3+k]:=true;
if k1+i>pp1 then pp1:=k1+i;
if k2+j>pp2 then pp2:=k2+j;
if k3+k>pp3 then pp3:=k3+k; end;
end;
end;
end;
end;
end;
end;
pr1:=pp1;
pr2:=pp2;
pr3:=pp3;
bo:=bi;bi:=bi xor 1;
end;
for k1:=1 to 100 do
for k2:=1 to 100 do
for k3:=1 to 100 do
if f[bo,k1,k2,k3] then
begin
o1:=k1 div a;
if k2 div b<o1 then o1:=k2 div b;
if k3 div c<o1 then o1:=k3 div c;
if o1>o2 then o2:=o1;
end;
writeln(ans+o2);
close(input);close(output);
end.