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 |
wrong 到死!!!!!!!!!!!#include<stdio.h>//2007/10/31 #include<string.h> void main() { int n,m,i,j,index,result[200]; char a[100],b[100]; for(i=0;i<200;i++)result[i]=0; gets(a);gets(b);m=strlen(a);n=strlen(b); for(i=0;i<n;i++) for(j=0;j<m;j++) { result[i+j]+=(b[i]-'0')*(a[j]-'0'); if(result[i+j]>=10) { result[i+j+1]+=(result[i+j]/10); result[i+j]=result[i+j]%10; } } index=result[m+n-1]==0?m+n-2:m+n-1; for(i=0;i<=index;i++) printf("%d",result[i]); printf("\n"); /*for(i=199;i>=0;i--) if(result[i]!=0){index=i;break;} if(i<0)printf("000\n"); else { for(i=0;i<=index;i++) printf("%d",result[i]); printf("\n"); }*/ } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator