马马虎虎就提交了。没想到AC了
可是我还是觉得有些地方不太对。
比如赋值的判断 万一mty可以耗费大量的时间干掉敌人呢?有没有可能输出错误的?
希望大牛出点NB的数据。或者解释下为什么能A?
f[i]表示去掉对手iHP的最短时间
h[i]表示去掉对手iHP的最多剩余HP
h的优先级低于f 也就是说在时间相同的情况下才对h进行更新。
const maxn=100;
var f,h:array[0..maxn]of longint;
i,j,k,m,n,p,x,y:longint;
begin
readln(n,m,p);
for i:=0 to n do
begin
f[i]:=maxlongint;
h[i]:=-maxlongint;
end;
f[0]:=0;
h[0]:=m;
for p:=1 to p do
begin
readln(x,y);
for i:=x to n do
begin
if h[i-x]<=y then continue;
[color=red]if (f[i-x]+1<f[i])or((f[i-x]+1=f[i])and(h[i-x]-y>h[i])){就是这里了。}[/color] then
begin
f[i]:=f[i-x]+1;
h[i]:=h[i-x]-y;
end;
end;
end;
if f[n]<maxint then
writeln(f[n])
else writeln('mty zhen mei yong!');
end.
附时间:
题目:mty的格斗
状态: [color=green]Accepted[/color]
测评机: Xeost[5]
得分: 100分
提交日期: 2010-11-11 17:38:00
有效耗时: 1594毫秒
测试结果1: [color=green]通过本测试点|有效耗时156ms [/color]
测试结果2: [color=green]通过本测试点|有效耗时157ms [/color]
测试结果3: [color=green]通过本测试点|有效耗时156ms [/color]
测试结果4: [color=green]通过本测试点|有效耗时187ms [/color]
测试结果5: [color=green]通过本测试点|有效耗时157ms [/color]
测试结果6: [color=green]通过本测试点|有效耗时156ms[/color]
测试结果7: [color=green]通过本测试点|有效耗时156ms [/color]
测试结果8: [color=green]通过本测试点|有效耗时156ms [/color]
测试结果9: [color=green]通过本测试点|有效耗时157ms [/color]
测试结果10: [color=green]通过本测试点|有效耗时156ms [/color]