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 |
数组开小了那么一点点就WA……呜呜呜这个AC了,但不知楼下的哥们说的直接用strlen有何影响 #include<stdio.h> #include<string.h> char a[44],b[44]; int c[200]={0}; int tell(char n) { return n-'0'; } void kan(int a,int b,int c[],int i) { c[i]+=a*b; if(c[i]>9) { kan(1,c[i]/10,c,i+1); c[i]%=10; } } int main() { gets(a);gets(b);int l1=strlen(a),l2=strlen(b),max=0; for(int i=l1-1;i+1;i--) { for(int j=l2-1;j+1;j--) { kan(tell(a[i]),tell(b[j]),c,l1+l2-2-i-j); } } for(int i=199;i+1;i--) { if(c[i]!=0) { max=i; break; } } for(int i=max;i+1;i--) printf("%d",c[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