Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:请哪位高手帮忙改一下,小弟非常感谢。刚打错了,其实另有错误。In Reply To:请哪位高手帮忙改一下,小弟非常感谢。 Posted by:6754228 at 2007-09-11 20:27:11 > /*未通过*/#include <iostream> > using namespace std; > #define Maxn 101 > int f(int a[],int b[],int c[]); > #define max(x,y) x>y?x:y > int main(){ > int n,i,j,m,m1; > char s[6]; > int b[6],a[Maxn],c[Maxn]; > for(i=0;i<Maxn;i++){ > a[i]=0; > c[i]=0; > } > while(cin>>s>>n){ > for(i=0;i<6;i++) > if(s[i]==46){ > m=6-i-1; > for(j=i;j<6;j++) > s[j]=s[j+1]; > goto Loop; > } > > > > Loop:; > m1=5; > for(i=4;i>0;i--){ > if(s[i]!='0') > break; > if(s[i]=='0'){ > m1--; > m--; > } > } > m=m*n; > for(i=1;i<=m1;i++) > a[i]=b[i]=s[m1-i]-'0'; > a[0]=b[0]=m1; > for(i=1;i<n;i++) > f(a,b,c); > for(i=max(a[0],m);i>0;i--){ > if(i==m) > cout<<'.'; > cout<<a[i]; > } > } > > return 0; > } > int f(int a[],int b[],int c[]){ > int i,j; > for(i=1;i<=a[0];i++) > for(j=1;j<=b[0];j++){ > c[i+j-1]+=a[i]*b[j]; > } > > for(i=1;i<101;i++){ > c[i+1]+=c[i]/10; > c[i]=c[i]%10; > } > for(i=Maxn-1;i>0&&c[i]==0;i--); > c[0]=i; > for(j=c[0];j>0;j--){ > a[j]=c[j]; > c[j]=0; > } > a[0]=c[0]; > c[0]=0; > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator