记录编号 |
5278 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[POI 1998] 潜水员的问题 |
最终得分 |
100 |
用户昵称 |
zxc111 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
1.172 s |
提交时间 |
2008-10-25 22:40:25 |
内存使用 |
4.90 MiB |
显示代码纯文本
program ooo;
var
i,j,k,n,m,x,y,min,max:longint;
a:array[0..1000,0..1000] of longint;
f:array[0..1000,0..1000] of boolean;
c:array[1..1000,1..3] of longint;
t:text;
begin
assign(t,'ple.in');
reset(t);
readln(t,x,y);
readln(t,n);
for i:=1 to n do
readln(t,c[i,1],c[i,2],c[i,3]);
close(t);
fillchar(f,sizeof(f),false);
fillchar(a,sizeof(a),0);
f[0,0]:=true;
for i:=1 to n do
for j:=80 downto 0 do
for k:=100 downto 0 do
if(j-c[i,1]>=0)and(k-c[i,2]>=0) then
if f[j-c[i,1],k-c[i,2]]=true then
if f[j,k]=true then
if a[j,k]>a[j-c[i,1],k-c[i,2]]+c[i,3] then
a[j,k]:=a[j-c[i,1],k-c[i,2]]+c[i,3] else else
begin
a[j,k]:=a[j-c[i,1],k-c[i,2]]+c[i,3];
f[j,k]:=true;
end;
min:=maxlongint;
for i:=x to 100 do
for j:=y to 100 do
if (f[i,j]=true)and(a[i,j]<min) then min:=a[i,j];
assign(t,'ple.out');
rewrite(t);
write(t,min);
close(t);
end.