记录编号 |
20452 |
评测结果 |
AAAAAAAAAA |
题目名称 |
逛街 |
最终得分 |
100 |
用户昵称 |
belong.zmx |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.172 s |
提交时间 |
2010-10-26 08:48:36 |
内存使用 |
0.50 MiB |
显示代码纯文本
program shop(input,output);
var
f:array[0..1000,0..100]of longint;
i,j,k:longint;
n,x,y:longint;
a:array[1..300,1..4]of longint;
function max(a,b:longint):longint;
begin
if a>b then max:=a else max:=b;
end;
begin
assign(input,'shop.in');
reset(input);
readln(n,x,y);
for i:=1 to n do
begin
readln(a[i,1],a[i,2],a[i,3],a[i,4]);
end;
close(input);
for i:=1 to n do
for j:=x downto 1 do
for k:=y downto 1 do
begin
if (j-a[i,1]>=0)and(k-a[i,2]>=0) then
f[j,k]:=max(f[j,k],f[j-a[i,1],k-a[i,2]]+a[i,3]);
if(j-a[i,1]*a[i,4]>=0)and(k-a[i,2]*a[i,4]>=0) then
f[j,k]:=max(f[j,k],f[j-a[i,1]*a[i,4],k-a[i,2]*a[i,4]]+a[i,3]*a[i,4]);
end;
assign(output,'shop.out');
rewrite(output);
writeln(f[x,y]);
close(output);
end.