# 为何WA了？求解

WrongAnswer, time = 122 ms, mem = 17424 KiB, score = 70

program P1431;
uses math;
var m,s,t,d,tt,ansd,anst,i,j:longint;
f:array[0..300001,0..13]of longint;
begin
tt:=m div 10;
d:=tt*60;
m:=m mod 10;
f[tt][m]:=d;
for i:=tt to t do
for j:=0to 13do
begin
f[i+1][j]:=max(f[i+1][j],f[i][j]+17);
if j<10then f[i+1][j+4]:=max(f[i+1][j+4],f[i][j])
else f[i+1][j-10]:=max(f[i+1][j-10],f[i][j]+60);
end;
ansd:=0; anst:=0;
for i:=tt to t do
begin
for j:=0to 13do
begin
if f[i][j]>=s then
begin
anst:=i; break;
end;
ansd:=max(ansd,f[i][j]);
end;
if anst>0then break;
end;
if anst>0then
begin
writeln('Yes'); writeln(anst);
end
else
begin
writeln('No'); writeln(ansd);
end;
end.

# 3 条评论

• @ 2013-10-13 09:20:24

AC标

• @ 2013-10-13 09:20:04

呵呵
var
m,s,t,ti:longint;
ms:array[1..2,0..300000] of longint;
ts:array[0..300000] of longint;
begin
ms[2,0]:=m;
ts[0]:=0;
for ti:=1 to t do
begin
if ms[2,ti-1] >= 10 then
begin
ms[1,ti]:=ms[1,ti-1]+60;
ms[2,ti]:=ms[2,ti-1]-10;
end
else
begin
ms[1,ti]:=ms[1,ti-1];
ms[2,ti]:=ms[2,ti-1]+4;
end;
if ts[ti-1]+17 > ms[1,ti] then
ts[ti]:=ts[ti-1]+17
else
ts[ti]:=ms[1,ti];
if ts[ti] >= s then
begin
writeln('Yes');
writeln(ti);
halt;
end;
//main
end;
writeln('No');
writeln(ts[t]);
end.

• @ 2013-10-07 08:28:32

敢问你for j：=0 to 13 do 的13是哪里来的。。。

• @ 2015-10-30 15:50:38

先把10以上的魔法全用光，剩下的魔法值为个位数最大为9，在加上休息一次所得到的4点就是13

• 1

ID
1431

5

6158

1917

31%

22