0
已解决
程之行
高级守护
高级守护
var
f:array [0..41,0..7] of longint;
a:array [0..40,0..40] of longint;
n,r,k,j,i:longint;
s1,s2:string;
function max(x,y:longint):longint;
begin
if x<y then exit(y);
exit(x);
end;
begin
readln(s1);
readln(r);
n:=length(s1);
r:=r-1;
for i:=1 to n do
for j:=i to n do
begin
s2:=copy(s1,i,j-i+1);
val(s2,a[i,j]);
end;
for i:=1 to n do
f[i,0]:=a[1,i];
for k:=1 to r do
for i:=k+1 to n do
for j:=k to i do
f[i,k]:=max(f[i,k],f[j,k-1]*a[j+1,i]);
writeln(f[n,r]);
end.
怎么让他在一行输入,付一小段这样的代码答的好的有赏
0
已采纳
程思怡
中级守护
中级守护
read(s);
p:=pos(' ',s);
n:=copy(s,1,p-1);
val(copy(s,p+1,length(s)),m);
不知道对不对你看一下吧!
程思怡在2018-03-03 21:36:40追加了内容
第一行应该是readln
0
0
0
0
0