答复: Re: Re: [cpp] Re: Cpp Digest, Vol 24, Issue 26

FCG ZHOU Minggang Minggang.ZHOU at alcatel-sbell.com.cn
Fri Mar 31 09:19:37 CST 2006


To: li guojian
	写信的时候注意下标题呀,这已经说了很多次了,最好取一个合适的标题,让别人一看就能懂,比如你这个问题就可以取&# 8220;求幂运算&# 8221;。
另外注意下你写程序时候的风格和排版


> -----原始邮件-----
> 发件人: cpp-bounces at codingnow.com [mailto:cpp-bounces at codingnow.com]代
>> Chen Shuo
> 发送时间: 2006年3月30日 13:34
> 收件人: C++ Discuss Group
> 主题: Re: Re: Re: [cpp] Re: Cpp Digest, Vol 24, Issue 26
> 
> 
> 你先做一个算整数的吧。
> 
> On 3/29/06, li guojian <guojianlee at gmail.com> wrote:
> >
> > >
> > >
> > ////pku acm 1005//
> > ///就是高精度运算,老是wa能不能帮忙看一下!
> >
> >
> > #include <stdio.h>
> > #define M 125
> > void main()
> > {
> >  int R[M];
> >  float r1;
> >  int   r,n,i,l=0;
> >  int   f;//要打印的小数长度;
> >  int   a;//要打印的整数长度;
> >
> >  //
> >  while(scanf("%f %d",&r1,&n)!=EOF)
> >  {
> >   i=125; //
> >  while(--i) R[i]=0;
> >  if(10.00<=r1&&r1<99.999)    f=3*n,a=2*n,r=r1*1000+0.5;
> >  else  if(2.0<=r1&&r1<10.0)    f=4*n,a=n,r=r1*10000+0.5;
> >  else if(1.0<=r1&&r1< 2.0)  f=4*n,a=1,r=r1*10000+0.5;
> >  else  a=0,f=4*n,r=r1*10000+0.5;
> >  //////////////////////
> >
> > /////////////////////////
> >  R[0]=r%10;
> >  R[1]=(r%100)/10;
> >  R[2]=(r%1000)/100;
> >  R[3]=(r%10000)/1000;
> >  R[4]=(r%100000)/10000;
> > //////////////////////////
> >  while(--n)
> >  {
> >   for(i=0;i<M;i++)
> >    R[i]*=r;
> >   //
> >   for(l=0;l<M-2;l++){
> >    R[l+1]+=R[l]/10;
> >    R[l]%=10;
> >   }
> >
> >  }
> >
> >  //if(a==0){
> >  for(i=f+a;i>=f;i--)
> >     if(R[i]!=0) break;
> >  for(;i>=f;i--)
> >   printf("%d",R[i]);
> >
> >   for(r=0;r<f;r++)
> >      if(R[r]!=0) break;
> >     if(r!=f) printf("%c",'.');
> >       for(;i>=r;i--)
> >        printf("%d",R[i]);
> > // }
> > // else if()
> >
> >        printf("%c",'\n');
> >  }
> > }
> > _______________________________________________
> > Cpp mailing list
> > Cpp at codingnow.com
> > http://codingnow.com/mailman/listinfo/cpp
> >
> >
> 
> _______________________________________________
> Cpp mailing list
> Cpp at codingnow.com
> http://codingnow.com/mailman/listinfo/cpp
> 



More information about the Cpp mailing list