查看状态 Show Status
题目:书的复制
状态: Unaccepted
测评机: Xeond[6]
得分: 90分
提交日期: 2010-7-30 22:04:00
有效耗时: 562毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时46ms
测试结果5: 测试结果错误.错误结果为:-2 -2
-1 -1
0 0
正确结果应为:1 1
2 4
5 7
8 10
测试结果6: 通过本测试点|有效耗时63ms
测试结果7: 通过本测试点|有效耗时47ms
测试结果8: 通过本测试点|有效耗时47ms
测试结果9: 通过本测试点|有效耗时46ms
测试结果10: 通过本测试点|有效耗时47ms
提交代码: view sourceprint?01.var
02.m,k,i,j,x:longint;
03.a,p:array[0..500]of longint;
04.f:array[0..500,0..500]of longint;
05.
06.function max(x,y:longint):longint;
07.begin
08.if x<y then exit(y) else exit(x);
09.end;
10.
11.procedure out(i,j:longint);
12.var v:longint;
13.begin
14.if i=1 then begin writeln(1,' ',j);exit;end;
15.for v:=i-1 to j-1 do
16.if max(f[i-1,v],p[j]-p[v])<=f[k,m] then
17.begin
18. out(i-1,v);
19. writeln(v+1,' ',j);
20. exit;
21. end;
22. end;
23.
24.begin
25.readln(m,k);
26.for i:=1 to m do begin
27.read(a[i]);
28.p[i]:=p[i-1]+a[i];
29.f[1,i]:=p[i];
30.end;
31.for i:=2 to k do
32.for j:=i to m do begin
33.f[i,j]:=10000000;
34.for x:=i-1 to j-1 do
35.if max(f[i-1,x],p[j]-p[x])<f[i,j] then
36.f[i,j]:=max(f[i-1,x],p[j]-p[x]);
37.end;
38.out(k,m);
39.end