记录编号 |
8248 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[BYVoid S1] 灵魂分流药剂 |
最终得分 |
100 |
用户昵称 |
zpl123 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.097 s |
提交时间 |
2008-11-13 13:13:45 |
内存使用 |
0.16 MiB |
显示代码纯文本
program soultap;
type
tt=array[0..10,0..100]of longint;
t2=array[0..100,0..100] of longint;
t3=array[0..10]of longint;
var
n,m,a,b:longint;
f:t2;
p,w,v:tt;
num:t3;
procedure init;
var
i,j,w1,v1,t1,p1:longint;
begin
assign(input,'soultap.in');
reset(input);
assign(output,'soultap.out');
rewrite(output);
readln(n,m,a,b);
fillchar(num,sizeof(num),0);
for i:=1 to n do
begin
readln(w1,v1,t1,p1);
inc(num[t1]);
w[t1,num[t1]]:=w1;
v[t1,num[t1]]:=v1;
p[t1,num[t1]]:=p1;
end;
close(input);
fillchar(f,sizeof(f),0);
end;
procedure main;
var
i,k,u,d,t:longint;
begin
for k:=1 to m do
for u:=a downto 0 do
for d:=b downto 0 do
for i:=1 to num[k] do
if (u-w[k,i]>=0)and(d-v[k,i]>=0) then
if f[u,d]<f[u-w[k,i],d-v[k,i]]+p[k,i] then
f[u,d]:=f[u-w[k,i],d-v[k,i]]+p[k,i];
end;
procedure print;
begin
writeln(f[a,b]);
close(output);
end;
begin
init;
main;
print;
end.