记录编号 1964 评测结果 AAAAAAAAAA
题目名称 乘法问题 最终得分 100
用户昵称 GravatarEnAsn 是否通过 通过
代码语言 Pascal 运行时间 0.053 s
提交时间 2008-09-10 20:01:58 内存使用 7.14 MiB
显示代码纯文本
program ex;
type
 ss=array[1..30,1..30,0..30]of string;
 sz=array[1..30,1..30]of string;
var
 a:ss;
 b:sz;
 f1,f2:text;
 n,k:integer;
procedure init;
 var
  i,j:integer;
  s:string;
 begin
  assign(f1,'chf.in');
  assign(f2,'chf.out');
  reset(f1);
  rewrite(f2);
  readln(f1,n,k);
  readln(f1,s);
  for i:=1 to n do
   for j:=1 to n do
     for k:=1 to k do
       a[i,j,k]:='0';
  for i:=1 to n do
    for j:=1 to n+1-i do
     b[i,j]:=copy(s,i,j);
  for i:=1 to n do
   a[i,n,0]:=b[i,n+1-i];
 end;
procedure fuc(i,n,k1:longint;x,y,z:string);
 var
  w,e,r:int64;
  code:integer;
 begin
  val(x,w,code);
  val(y,e,code);
  val(z,r,code);
  if w<e*r then
    str(e*r,a[i,n,k1]);
 end;
procedure main;
 var
  i,k1,x:integer;
 begin
  for i:=n-1 downto 1 do
   for k1:=1 to k do
    if n-i>=k1 then
     for x:=1 to n-i do
      fuc(i,n,k1,a[i,n,k1],b[i,x],a[i+x,n,k1-1]);
 end;
begin
 init;
 main;
 writeln(f2,a[1,n,k]);
 close(f1);
 close(f2);
end.