测评机: Xeost[5]
得分: 80分
提交日期: 2010-11-11 17:02:00
有效耗时: 500毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 测试结果错误.错误结果为:43318.41
正确结果应为:115.81
测试结果6: 测试结果错误.错误结果为:43321.79
正确结果应为:113.07
测试结果7: 通过本测试点|有效耗时46ms
测试结果8: 通过本测试点|有效耗时47ms
测试结果9: 通过本测试点|有效耗时47ms
测试结果10: 通过本测试点|有效耗时47ms
var
i,j,start,n,k,ans:longint;
a:array[0..100] of longint;
f:array[0..100,0..100] of longint;
function max(x,y:longint):longint;
begin
if x>y then exit(x) else exit(y);
end;
begin
assign(input,'dizhen.in');reset(input);
//assign(output,'dizhen.out');rewrite(output);
readln(n,start,k);
for i:=2 to n do
read(a[i]);
if (a[n]>start)or(a[n]+k<start) then
begin
write('YI DING YAO JIAN CHI JI HUA SHENG YU');
close(input);close(output);
halt;
end;
f[n,start]:=start;
for i:=n-1 downto 2 do
for j:=a[i] to a[i]+k do
begin
f[i,j]:=f[i+1,j-1];
f[i,j]:=max(f[i,j],f[i+1,j+1]);
f[i,j]:=max(f[i,j],f[i+1,j]);
if f[i,j]>0 then f[i,j]:=f[i,j]+j;
end;
ans:=0;
for i:=a[2] to a[2]+k do
if f[2,i]>ans then ans:=f[2,i];
if ans>0 then write(ans/(n-1):0:2) else
write('YI DING YAO JIAN CHI JI HUA SHENG YU');
close(input);close(output);
end.
var a:array[1..1000] of longint;
f:array[1..1000,1..1000] of longint;
n,k,v,i,j,ans:longint;
function max(x,y:longint):longint;
begin
if x>y then max:=x
else max:=y;
end;
begin
fillchar(a,sizeof(a),0);
fillchar(f,sizeof(F),0);
read(n,v,k);
for i:=n-1 downto 1 do
read(a[i]);
if (v>a[1]+k) or (a[1]>v) then begin
writeln('YI DING YAO JIAN CHI JI HUA SHENG YU');
halt;
end;
f[1,v]:=v;
for i:=1 to n-2 do
for j:=1 to 300 do
if f[i,j]>0 then begin
if (j+1>=a[i+1]) and (j+1<=k+a[i+1]) then f[i+1,j+1]:=max(f[i+1,j+1],f[i,j]+j+1);
if (j>=a[i+1]) and (j<=k+a[i+1]) then f[i+1,j]:=max(f[i+1,j],f[i,j]+j);
if (j-1>=a[i+1]) and (j-1<=k+a[i+1]) then f[i+1,j-1]:=max(f[i+1,j-1],f[i,j]+j-1);
end;
ans:=0;
for i:=1 to 300 do
ans:=max(ans,f[n-1,i]);
if ans>0 then writeln(ans/(n-1):0:2)
else writeln('YI DING YAO JIAN CHI JI HUA SHENG YU');
end.
数据范围太水 f[i,j]是总时间 i是层数 j是时间
分给我吧~~~
我刚开始也跟你一样wa,不过我WA50……
后来把数组开到200就AC了,
因为JDC跑到速度可能大于100,因为JDC在路程中的速度应为当前速度+k值,这点一定要注意,哎我AC率更低了。。