比赛 20140711B班小测 评测结果 WWWWWWWWWWWWWW
题目名称 残酷的数学老师 最终得分 0
用户昵称 运行时间 0.025 s
代码语言 Pascal 内存使用 0.13 MiB
提交时间 2014-07-11 15:44:58
显示代码纯文本
var
  n,p,k:longint;
  n1,n2:ansistring;
procedure suan(n1,n2:ansistring);
var
  i,j,x,a1,b1,c1:longint;
  a,b,c:array[0..15000]of longint;
begin
  a1:=length(n1);
  b1:=length(n2);
  for i:=0 to a1 do a[a1-i+1]:=ord(n1[i])-ord('0');
  for i:=0 to b1 do b[b1-i+1]:=ord(n2[i])-ord('0');
  for i:=0 to a1 do
    begin
      x:=0;
      for j:=0 to b1 do
        begin
          x:=a[i]*b[j]+x div 10+c[i+j-1];
          c[i+j-1]:=x mod 10;
        end;
      c[i+j]:=c[i+j]+x div 10;
    end;
  c1:=i+j;
  while (c[c1]=0)and(c1>1) do dec(c1);
  for i:=c1 downto 0 do n1:=n1+chr(c[i]+ord('0'));
end;
begin
  assign(input,'cruel1.in');
  assign(output,'cruel1.out');
  reset(input);
  rewrite(output);
  readln(n1,p);
  n2:=n1;
  for k:=1 to p  do suan(n1,n2);
  for k:=0 to length(n1)do
    begin
      writeln(n1[k]);
      if (k+1)mod 70=0 then writeln;
    end;
  close(input);
  close(output);
end.