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 |
wwaaaaaaaaa! 为什么呢。。。。。大牛快进吧,快想不开了#include<iostream> #include<string.h> #include<cstdio> using namespace std; int main() { int inc=0,inc1; int i,r; int temp; char a[44],b[44]; int a1[45],b1[45]; int c[90]={0}; memset(c,0,sizeof(c)); inc=0; scanf("%s",a); scanf("%s",b); int len1,len2; len1=strlen(a); len2=strlen(b); for(i=0;i<len1;i++) { a1[len1-i-1]=a[i]-'0'; } for(i=0;i<len2;i++) { b1[len2-i-1]=b[i]-'0'; } for(i=0;i<len1;i++) { for(r=0;r<len2;r++) { temp=c[i+r]; c[i+r]=(c[i+r]+a1[i]*b1[r]+inc)%10; inc=(temp+a1[i]*b1[r]+inc)/10; } c[i+r]+=inc; inc =0; } inc1=0; for(i=0;i<30;i++) { c[i]=(c[i]+inc1)%10; inc1=(c[i]+inc1)/10; } for(i=30;i>=0;i--) if(c[i]!=0) { temp=i; break; } for(i=temp;i>=0;i--) cout<<c[i]; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator