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:我的程序...我用得方法很简单的....基本十进制乘法...而且在自己机器上也能通过..为什么就是WRONG ANSWER呢In Reply To:我的程序...我用得方法很简单的....基本十进制乘法...而且在自己机器上也能通过..为什么就是WRONG ANSWER呢 Posted by:uni at 2004-05-04 17:07:38 > #include <stdio.h> > #define stop getchar(); > > void main() > {int num,i,j,res[181],rsp[5],rmd,dex,resp[181],rpk,s,stk; > char str[7]; > > for(stk=1;stk<=400;stk++) > { > scanf("%s %d",str,&num); > stop > rmd=0; > dex=0; > if (str[0]==EOF) break; > for (i=0;i<=6;i++) > {if (rmd==1) > dex++; > if (str[i]=='.') > rmd=1; > if ((str[i]<='9')&&(str[i]>='0')) > rsp[4+rmd-i]=str[i]-'0'; > } > dex--; > //input.ok > > for(i=0;i<=180;i++) > res[i]=0; > res[0]=1; > //start.ok > > > for(s=1;s<=num;s++) > { > > for (i=0;i<=180;i++) > resp[i]=res[i]; > //copy.ok > > for(i=0;i<=180;i++) > res[i]=0; > //clean res.ok > > for (i=0;i<=4;i++) > {for (j=0;j<=180;j++) > res[j]=res[j]+resp[j]* rsp[4-i]; > //mux.ok > rpk=0; > for(j=0;j<=180;j++) > {res[j]=res[j]+rpk; > rpk=res[j]/10; > res[j]=res[j]%10; > } > //addon.ok > if(i==4) break; > for (j=0;j<=179;j++) > res[180-j]=res[179-j]; > res[0]=0; > //shift.ok > } > } > > dex = dex * num ; > > for(i=0;i<=dex-1;i++) > {if (res[i]!=0) break;} > if (i!=0) res[i-1]=-2; > > rmd=0; > > for(i=0;i<=180;i++) > > {j=180-i; > if ((res[j]!=0)||(j==dex)) rmd=1; > if (res[j]==-2) break; > if (rmd==1) > { > printf("%d",res[j]); > if ((j==dex)&&(res[j-1]!=-2)) printf("."); > > > } > > > } > printf("\n"); > > } > > > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator