记录编号 |
40631 |
评测结果 |
AAAAAAAAAAAAAT |
题目名称 |
[暑假培训2012] 残酷的数学老师 |
最终得分 |
92 |
用户昵称 |
bingo |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
1.693 s |
提交时间 |
2012-07-18 15:07:47 |
内存使用 |
0.24 MiB |
显示代码纯文本
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:=15002 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[j]);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+2) 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+2) 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+2) 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.