忘请高人指点..

编译通过...

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

├ 测试数据 02:答案错误... ├ 标准行输出

 ├ 错误行输出

├ 测试数据 03:答案错误... ├ 标准行输出

 ├ 错误行输出

├ 测试数据 04:答案错误... ├ 标准行输出

 ├ 错误行输出

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

程序

program P1218;

var a:array[1..500] of longint;

fmax,fmin:array[-1..90,-1..500] of longint;

i,l,k,j,n,max,m,x,min:longint;

function sum(ii,ll:longint):longint;

var s:longint;

begin

s:=0;

while ii

1 条评论

  • @ 2016-10-25 19:46:25

    不要胡写。
    program knif;
    var
    n,m,i,j,p,ans,ans1,k:longint;
    a:array[0..51] of longint;
    f,g:array[0..10,0..101,0..101] of longint;
    s:array[0..101,0..101] of longint;
    begin
    readln(n,m);
    for i:=1 to n do
    begin
    readln(a[i]); a[i+n]:=a[i];
    end;
    for i:=1 to 2*n do
    for j:=i to 2*n do
    begin
    for k:=i to j do
    s[i,j]:=s[i,j]+a[k];
    s[i,j]:=((s[i,j] mod 10)+10) mod 10;
    end;
    f[1]:=s; g[1]:=s;
    for p:=2 to m do
    for i:=1 to 2*n-1 do
    for j:=i+p to 2*n-1 do
    begin
    f[p,i,j]:=0; g[p,i,j]:=maxlongint;
    for k:=i+p-1 to j-1 do
    begin
    if f[p-1,i,k]*s[k+1,j]>f[p,i,j] then f[p,i,j]:=f[p-1,i,k]*s[k+1,j];
    if g[p-1,i,k]*s[k+1,j]<g[p,i,j] then g[p,i,j]:=g[p-1,i,k]*s[k+1,j];
    end;
    end;
    ans1:=maxlongint;
    ans:=-maxlongint;
    for i:=1 to n do
    begin
    if f[m,i,i+n-1]>ans then ans:=f[m,i,i+n-1];
    if g[m,i,i+n-1]<ans1 then ans1:=g[m,i,i+n-1];
    end;
    writeln(ans1);
    writeln(ans);
    end.

  • 1

信息

ID
1218
难度
5
分类
动态规划 | 环形DP 点击显示
标签
递交数
2837
已通过
1084
通过率
38%
被复制
17
上传者