为何WA了?求解

编译成功

测试数据 #0: Accepted, time = 0 ms, mem = 17420 KiB, score = 10
测试数据 #1: WrongAnswer, time = 0 ms, mem = 17420 KiB, score = 0
测试数据 #2: WrongAnswer, time = 0 ms, mem = 17420 KiB, score = 0
测试数据 #3: Accepted, time = 15 ms, mem = 17420 KiB, score = 10
测试数据 #4: Accepted, time = 15 ms, mem = 17420 KiB, score = 10
测试数据 #5: Accepted, time = 31 ms, mem = 17416 KiB, score = 10
测试数据 #6: Accepted, time = 15 ms, mem = 17424 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 17420 KiB, score = 10
测试数据 #8: Accepted, time = 46 ms, mem = 17424 KiB, score = 10
测试数据 #9: WrongAnswer, time = 0 ms, mem = 17420 KiB, score = 0
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
readln(m,s,t);
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
    readln(m,s,t);
    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
分类
动态规划 | 背包 点击显示
标签
递交数
6160
已通过
1919
通过率
31%
被复制
24
上传者