记录编号 |
112555 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[POI 1998] 潜水员的问题 |
最终得分 |
100 |
用户昵称 |
FoolMike |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.000 s |
提交时间 |
2014-07-16 15:16:09 |
内存使用 |
0.03 MiB |
显示代码纯文本
var
t,a,n,x,y,i,j:longint;
b,c,d:longint;
f:array[0..21,0..79]of longint;
begin
assign(input,'ple.in');assign(output,'ple.out');
reset(input);rewrite(output);
readln(t,a);
readln(n);
for i:=0 to t do
for j:=0 to a do
if (i<>0)or(j<>0) then f[i,j]:=-1;
for n:=1 to n do
begin
read(b,c,d);
for i:=t downto 0 do
for j:=a downto 0 do
if f[i,j]>-1 then
begin
if i+b>t then x:=t else x:=i+b;
if j+c>a then y:=a else y:=j+c;
if (f[x,y]>f[i,j]+d)or(f[x,y]=-1) then f[x,y]:=f[i,j]+d;
end;
end;
writeln(f[t,a]);
close(input);close(output);
end.
var
t,a,n,x,y,i,j:longint;
b,c,d:longint;
f:array[0..21,0..79]of longint;
begin
assign(input,'ple.in');assign(output,'ple.out');
reset(input);rewrite(output);
readln(t,a);
readln(n);
for i:=0 to t do
for j:=0 to a do
if (i<>0)or(j<>0) then f[i,j]:=-1;
for n:=1 to n do
begin
read(b,c,d);
for i:=t downto 0 do