救命!全超时是怎么回事!

各位大牛,帮看看吧!救命啊!一道基础题

program p1010;

const

inf='p1010.in';

ouf='p1010.out';

var

st,s,t:string;

i,j,k,n,p,q,l,x,y:longint;

a,b,c:array[1..2000] of longint;

procedure jisuan;

begin

p:=pos('.',st);

q:=length(st)-p;

delete(st,p,1);

l:=length(st);

fillchar(a,sizeof(a),0);

for i:=1 to length(st) do

a[l-i+1]:=ord(st[i])-48;

for i:=1 to 2000 do

b[i]:=a[i];

for i:=1 to k-1 do begin

for j:=1 to 2000 do begin

c[j]:=a[j];

a[j]:=0;

end;

j:=2000;

while c[j]=0 do dec(j);

for x:=1 to l do

for y:=1 to j do

a[x+y-1]:=a[x+y-1]+c[y]*b[x];

for j:=1 to 1999 do begin

a[j+1]:=a[j+1]+a[j] div 10;

a[j]:=a[j] mod 10;

end;

end;

x:=2000;

while a[x]=0 do dec(x);

y:=1;

while a[y]=0 do inc(y);

for i:=x downto q*k+1 do write(a[i]);

write('.');

for i:=k*q downto y do write(a[i]);

writeln;

end;

begin

assign(input,inf);

reset(input);

assign(output,ouf);

rewrite(output);

while not seekeof do begin

readln(st);

if st='' then break;

while (st[1]=' ')or(st[1]='0') do delete(st,1,1);

while st[length(st)]='0' do delete(st,length(st),1);

k:=pos(' ',st);

s:=copy(st,k,length(st)-k+1);

delete(st,k,length(st)-k+1);

while s[1]=' ' do delete(s,1,1);

val(s,k,j);

jisuan;

end;

close(input);

close(output);

end.

5 条评论

  • 1

信息

ID
1010
难度
5
分类
模拟 点击显示
标签
递交数
1929
已通过
662
通过率
34%
被复制
26
上传者