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,为什么啊,真的和读入有关吗?#include <iostream> #include <string> using namespace std; int main() { string a,b; int lena,lenb,lenc; int c[100]={0}; cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;++i) { for(int j=0;j<lenb;++j) { c[i+j]+=(a[i]-48)*(b[j]-48); c[i+j+1]+=c[i+j]/10; c[i+j]%=10; } } c[lena+lenb-1]==0?lenc=lena+lenb-1:lenc=lena+lenb; for(int m=lenc-1;m>=0;--m)cout<<c[m]; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator