记录编号 20467 评测结果 AAAAAAAAAA
题目名称 逛街 最终得分 100
用户昵称 Gravatardonny 是否通过 通过
代码语言 Pascal 运行时间 0.186 s
提交时间 2010-10-26 09:35:13 内存使用 0.50 MiB
显示代码纯文本
program shop(input,output);
type
  ss=record
    w,v,t,h:longint;
  end;
var
  i,j,k:longint;
  a:array[1..300]of ss;
  n,x,y:longint;
  f:array[0..100,0..1000]of longint;
function mm(p,q:longint):longint;
begin
  if p>q then exit(p)
  else exit(q);
end;
begin
  assign(input,'shop.in');
  reset(input);
  assign(output,'shop.out');
  rewrite(output);
  readln(n,x,y);
  for i:=1 to n do
    readln(a[i].w,a[i].v,a[i].t,a[i].h);
  for i:=0 to 100 do
    for j:=0 to 1000 do
      f[i,j]:=0;
  for i:=1 to n do
    for j:=y downto 1 do
      for k:=x downto 1 do
      begin
        if (j-a[i].v>=0) and (k-a[i].w>=0) then
          f[j,k]:=mm(f[j,k],f[j-a[i].v,k-a[i].w]+a[i].t);
        if ((j-(a[i].v*a[i].h))>=0)and((k-(a[i].w*a[i].h))>=0) then
          f[j,k]:=mm(f[j,k],f[j-(a[i].v*a[i].h),k-(a[i].w*a[i].h)]+(a[i].t*a[i].h));
      end;
  writeln(f[y,x]);
  close(input);
  close(output);
end.