📄 最大乘法.txt
字号:
CONST
maxn=50;
VAR
f,g:array[0..maxn,0..maxn]of longint;
n,k,i,j,p,t1:longint;
code:integer;
s,s1:string;
BEGIN
readln(n,k);
readln(s);
for i:=1 to n do
for j:=1 to n do
begin
s1:=copy(s,i,j-i+1);
val(s1,g[i,j],code);
end;
for i:=1 to n do
f[i,0]:=g[1,i];
for i:=1 to n do
for j:=1 to i-1 do
begin
t1:=f[j,0]*g[j+1,i];
if t1>f[i,1]
then f[i,1]:=t1;
end;
for i:=2 to n do
for j:=1 to k do
begin
for p:=i downto 1 do
begin
if p<=j-1 then break;
t1:=f[p,j-1]*g[p+1,i];
if t1>f[i,j]
then f[i,j]:=t1;
end;
end;
writeln(f[n,k]);
END.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -