题目:
话说乾隆带着他的宰相刘罗锅和你出巡江南,被杭州城府邀请去听戏,至于什么戏,那就不知了。乾隆很高兴,撒酒与君臣共享。三更欲回住处,可是乾隆这人挺怪,他首先要到西湖边散散步,而且命令不准有人跟着他。
小醉,步于西湖岸,停于断桥前,突闻琴声悠悠,歌儿婉婉。这乐曲不哀伤不愁怅,少了一分怨女的羁绊,多了一分少女的期盼。乾隆走上前去,视其背影,为一女子手抚古琴,悠悠而唱。可是这么晚了,小女怎么还不回家呢,莫非是她起早床?乾隆走上前去,小声问道:“伊为何未宿?”,小女沉默片刻,转身而来。顿时,顿时,顿时!!!!!乾隆惊呆了!!!!哇!!!!噻!!!!!!这人,这伊!!!!原来!!!!!!!不是一个美女(狂汗ing)。小女并未回答她的话,只是与乾隆侃了侃诗。乾隆兴哉,问其曰:“不知偶能助伊否?”,小女曰:“偶无所以助,且有一事相求,愿君能解之。”
乾隆一看,立刻晕到在地,片刻而起,曰:“明日必解之”,且去。
回到家中,乾隆夜召你“入寝”,曰:“如此姑娘,如此情调,如此罗曼蒂克,竟然丢一个如此煞风景之问”,一边发气,一边把这个问题交给你。你一看,顿然发现,原来是用蝌蚪文写的:
Problems involving the computation of exact values of very largemagnitude and precision are common. For example, the computation ofthe national debt is a taxing experience for many computersystems.
This problem requires that you write a program to compute the exactvalue of Rn where R is a real number ( 0.0 < R <= 9999.9) andn is an integer such that 0 < n <= 200.
此时的你,已经是皇帝身边的小太监,自然有必要为皇上解决此题。
var
xx:string;
a,c:array[0..10000] of longint;
b:array[0..100] of longint;
n,z,start,k,k2,i,p:longint;
x:real;
procedure zhengshu(x:longint);
var
l,i,j:longint;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
k:=0;
while x>0 do
begin
inc(k);
a[k]:=x mod 10;
b[k]:=a[k];
x:=x div 10;
end;
k2:=k;
for l:=2 to n do
begin
c:=a;
fillchar(a,sizeof(a),0);
for i:=1 to k do
for j:=1 to k2 do
a[i+j-1]:=a[i+j-1]+c[i]*b[j];
k:=k+k2-1;
for i:=1 to k do
if a[i]>9 then
begin
a[i+1]:=a[i+1]+a[i]div 10;
a[i]:=a[i] mod10;
end;
while a[k+1]>0 do
begin
k:=k+1;
a[k+1]:=a[k+1]+a[k] div10;
a[k]:=a[k] mod 10;
end;
end;
end;
begin
while not(eof) do
begin
readln(xx);
p:=pos(' ',xx);
i:=p+1;
while xx[i]=' ' do
inc(i);
val(copy(xx,i,length(xx)-i+1),n);
delete(xx,p,length(xx)-p+1);
val(xx,x);
p:=length(xx)-pos('.',xx);
for i:=1 to p do
x:=x*10;
zhengshu(round(x));
if p>0 then
begin
z:=p*n+1;
for i:=k downto z do
write(a[i]);
z:=z-1;
a[z+1]:=1;
start:=1;
while a[start]=0 do
inc(start);
if start