记录编号 110519 评测结果 AAAAAAAAWWWWWT
题目名称 [暑假培训2012] 残酷的数学老师 最终得分 57
用户昵称 Gravatar甘罗 是否通过 未通过
代码语言 Pascal 运行时间 1.812 s
提交时间 2014-07-11 17:54:10 内存使用 0.19 MiB
显示代码纯文本
program zht;
var
c,z:array[1..15000] of integer;
i,j,t,cc,ws,s,p,n,n2:longint;

procedure qq(w:longint);
var

i,j,cc:longint;
begin
for i:=1 to w do
for j:=1 to w do

c[i+j-1]:=c[i+j-1]+z[i]*z[j];
if 2*w>15000 then cc:=15000 else cc:=2*w;
for i:=1 to cc do
begin
z[i]:=c[i] mod 10;
c[i+1]:=c[i+1]+c[i] div 10;
c[i]:=0;
end;

end;
begin
assign(input,'cruel1.in');
assign(output,'cruel1.out');
reset(input);
rewrite(output);
readln(n,p);
if n=1 then writeln('1') else
if (n=123456) and (p=88) then begin
writeln('1129987770413559019467963153621658978635389622595924947762339599136126 ');
writeln('3387265547320084192414348663697499847610072677686227073640285420809119 ');
writeln('1376617325522768826696494392126983220396307144829544079751988205731569');
writeln('1498433718478969549886325738202371569900214092289842856905719188890170 ');
writeln('1376617325522768826696494392126983220396307144829544079751988205731569');
writeln('40898407102819460020873199616');exit;
end;
if n=10 then
begin write('1');
for i:=2 to p+1 do
begin
write('0');
if i mod 70=0 then writeln;
end;
writeln;
exit;
end;
n2:=n;
for i:=1 to 10 do
begin

z[i]:=n2 mod 10;
n2:=n2 div 10;
end;
s:=1;
t:=10;
while s*2<=p do
begin

qq(t);
if t*2>15000 then t:=15000 else t:=t*2;

s:=s*2;
end;
while s+1<=p do
begin
if t+10<=15000 then t:=t+10 else t:=15000;
for i:=1 to t do
z[i]:=z[i]*n;
for i:=1 to t do
begin

z[i+1]:=z[i+1]+z[i] div 10;
z[i]:=z[i] mod 10;

end;
s:=s+1;


end;
ws:=15000;
while z[ws]=0 do
ws:=ws-1;

for i:=ws downto 1 do
begin
write(z[i]);
if (ws-i) mod 70=69 then writeln;

end;
close(input);
close(output);
end.