dp。。s 的范围到底是多少。。

编译通过...

├ 测试数据 01:答案正确... 0ms

├ 测试数据 02:答案正确... 0ms

├ 测试数据 03:答案正确... 0ms

├ 测试数据 04:答案正确... 0ms

├ 测试数据 05:运行时错误...| 错误号: 128 |

├ 测试数据 06:运行时错误...| 错误号: 128 |

├ 测试数据 07:运行时错误...| 错误号: 128 |

├ 测试数据 08:答案正确... 0ms

├ 测试数据 09:运行时错误...| 错误号: 128 |

├ 测试数据 10:答案正确... 0ms

---|---|---|---|---|---|---|---|-

Unaccepted 有效得分:60 有效耗时:0ms

program p1431;

var

m,s,t,i,j,max,maxw:longint;

f:array[0..1,0..1000000]of longint;

begin

readln(m,s,t);

for i:=0 to 1 do

for j:=0 to s+60 do

f:=-10000000;

f[0,0]:=m;

maxw:=0;

for i:=1 to t do

for j:=0 to s+60 do

begin

max:=-maxlongint;

if j-60>=0 then

if f[(i-1)and 1,j-60]-10>max then

max:=f[(i-1)and 1,j-60]-10;

if f[(i-1)and 1,j]+4>max then

max:=f[(i-1)and 1,j]+4;

if j-17>=0 then

if f[(i-1)and 1,j-17]>max then

max:=f[(i-1)and 1,j-17];

f[i and 1,j]:=max;

if f[i and 1,j]>=0 then

if j>maxw then

maxw:=j;

if j>=s then

if f[i and 1,j]>=0 then

begin

writeln('Yes');

writeln(i);

halt;

end;

end;

writeln('No');

writeln(maxw);

end.

哪里有错吗??再有。。s的范围到底是多少??、、

30%的数据满足:1

1 条评论

  • @ 2009-08-04 23:22:51

    谢各位。。。ms还没人帮我。。

    我明白了。。把 108 理解为108了。。其实是10^8。。。。。

    换了种方法dp。。AC了。。

    谢谢还没来得及帮我的人。。。⊙﹏⊙b汗

  • 1

信息

ID
1431
难度
5
分类
动态规划 | 背包 点击显示
标签
递交数
6154
已通过
1916
通过率
31%
被复制
22
上传者