Description

对数值很大、精度很高的数进行高精度计算是一类十分常见的问题。比如,对国债进行计算就是属于这类问题。 

 

现在要你解决的问题是:对一个实数R( 0.0 < R < 99.999 ),要求写程序精确计算 R 的 n 次方(Rn),其中n 是整数并且 0 < n <= 25。

Input

T输入包括多组 R 和 n。 R 的值占第 1 到第 6 列,n 的值占第 8 和第 9 列。

Output

对于每组输入,要求输出一行,该行包含精确的 R 的 n 次方。输出需要去掉前导的 0 后不要的 0 。如果输出是整数,不要输出小数点。

Sample Input

95.123 120.4321 205.1234 156.7592  998.999 101.0100 12

Sample Output

548815620517731830194541.899025343415715973535967221869852721
.00000005148554641076956121994511276767154838481760200726351203835429763013462401
43992025569.928573701266488041146654993318703707511666295476720493953024
29448126.764121021618164430206909037173276672
90429072743629540498.107596019456651774561044010001
1.126825030131969720661201
代码
program poj1001;
type arr=array[0..1000]of longint;
var y,i,j,len,t,m:longint;
x:double;
a,b,c:arr;
ss,s,ans:string;
flag:boolean;
function mul(a,b:arr):arr;
var c:arr;i,j,x:longint;
begin
fillchar(c,sizeof(c),
0);
c[
0]:=a[0]+b[0]+1;
for i:=1 to a[0] do
begin
x:
=0;
for j:=1 to b[0] 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]:=x div 10;
end;
while ((c[c[0]]=0)and(c[0]>1)) do dec(c[0]);
exit(c);
end;


function pow(y:longint):arr;
var t:arr;
begin
if (y=1) then exit(a);
t:
=pow(y shr 1);
t:
=mul(t,t);
if odd(y) then t:=mul(t,a);
exit(t);
end;



begin
while not eof do
begin
flag:
=false;
fillchar(a,sizeof(a),
0);
len:
=0;
readln(ss);
s:
=copy(ss,pos(' ',ss),length(ss)-pos(' ',ss)+1);
val(s,y);
if y=0 then begin writeln(1);continue;end;
delete(ss,pos(
' ',ss),length(ss)-pos(' ',ss)+1);
if pos('.',ss)>0 then
while ss[length(ss)]='0' do delete(ss,length(ss),1);
for i:=1 to length(ss) do
begin
if ss[i]='.' then begin flag:=true;continue;end;
if flag then inc(len);
end;
delete(ss,pos(
'.',ss),1);
while (ss[1]='0') and (length(ss)>1) do delete(ss,1,1);
for i:=length(ss) downto 1 do
begin
inc(a[
0]);
a[a[
0]]:=ord(ss[i])-48;
end;
c:
=pow(y);
if len=0 then
begin
for i:=c[0] downto 1 do write(c[i]);
writeln;
continue;
end
else
begin
if a[0]=len then
begin
write(
'.');
for i:=len*y downto 1 do write(c[i]);
writeln;
continue;
end;
len:
=c[0]-len*y;
m:
=1;
while c[m]=0 do inc(m);
for i:=c[0] downto c[0]-len+1 do write(c[i]);
write(
'.');
for i:=c[0]-len downto m do write(c[i]);
end;
writeln;
end;
end.