记录编号 |
2052 |
评测结果 |
AAAAAAAAAA |
题目名称 |
乘法问题 |
最终得分 |
100 |
用户昵称 |
zpl123 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
10.000 s |
提交时间 |
2008-09-11 13:13:41 |
内存使用 |
0.00 MiB |
显示代码纯文本
program chf1;
const
maxn=50;
var
f,num:array[0..maxn,0..maxn]of int64;
t1:int64;
n,k,i,j,p:longint;
code:integer;
s,s1:string;
begin
assign(input,'chf.in');
assign(output,'chf.out');
reset(input);
rewrite(output);
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,num[i,j],code);
end;
for i:=1 to n do
f[i,0]:=num[1,i];
for i:=1 to n do
for j:=1 to i-1 do
begin
t1:=f[j,0]*num[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]*num[p+1,i];
if t1>f[i,j]
then f[i,j]:=t1;
end;
end;
writeln(f[n,k]);
close(input); close(output);
end.