比赛 20130725暑期B班1测 评测结果 AAAAWAAWAAWWWT
题目名称 残酷的数学老师 最终得分 57
用户昵称 bingo 运行时间 1.698 s
代码语言 Pascal 内存使用 0.24 MiB
提交时间 2012-07-18 11:27:53
显示代码纯文本
var
 b:array[1..20]of integer;
 a,c:array[1..20001]of integer;
 n,i,j,k,p,x:longint;
 s:string;
 f,g:text;
procedure print;
 var
  i,j,k:integer;
 begin
  k:=0;
  for i:=15001 downto 1 do
   if a[i]<>0 then begin
                    for j:=i downto 1 do
                    begin
                     k:=k+1;
                     if k=71 then begin k:=1;writeln(g);write(g,a[i]);end
                             else write(g,a[j]);
                    end;
                    exit;
                   end;
 end;
procedure can;
 var
  i,j,k:integer;
 begin
  for i:=1 to length(s)*x do
   for j:=1 to length(s) do
    c[i+j-1]:=c[i+j-1]+a[i]*b[j];
  for i:=1 to length(s)*(x+1) do
   begin
    c[i+1]:=c[i+1]+c[i]div 10;
    c[i]:=c[i]mod 10;
   end;
  for i:=1 to length(s)*(x+1) do
   a[i]:=c[i];
 end;
begin
 assign(f,'cruel1.in');
 assign(g,'cruel1.out');
 reset(f);
 rewrite(g);
 readln(f,n,p);
 str(n,s);
 for i:=1 to length(s) do
  a[length(s)-i+1]:=ord(s[i])-48;
 for i:=1 to length(s) do
  b[i]:=a[i];
 for x:=1 to p-1 do
 begin
  fillchar(c,sizeof(c),0);
  can;
 end;
 print;
 close(f);
 close(g);
end.