做了很久很久……真的太繁琐了!!
class Solution {
public:string multiply(string num1, string num2) {string s;string str;if (num1 == "0" || num2 == "0") return "0";for(int i=num2.size()-1;i>=0;i--){int c2=num2[i]-'0';string x;int b=0;for(int j=num1.size()-1;j>=0;j--){int c1=num1[j]-'0';int c3=c1*c2;if(b>=1) c3+=b;if(c3>9){x.insert(x.begin(),c3%10+'0');b=c3/10;}else{x.insert(x.begin(),c3+'0');b=0;}if(b>=1&&j==0&&c3>9){char u=c3/10+'0';x.insert(x.begin(),u);}}if(s=="") s=x;else{int u=num2.size()-i-1;while(u>0) {x.push_back('0');u--;}s=ad(s,x);}}return s;}string ad(string a,string b){if(a.size()>=b.size()){for(int i=1;i<=a.size();i++){if(i<b.size()+1){a[a.size()-i]+=b[b.size()-i]-'0';if(a[a.size()-i]>'9'){a[a.size()-i]-=10;if(a.size()-i==0){a.insert(a.begin(),'1');}else a[a.size()-i-1]+=1;}}else{if(a[a.size()-i]>'9'){a[a.size()-i]-=10;if(a.size()-i==0){a.insert(a.begin(),'1');}else a[a.size()-i-1]+=1;}}}return a;}else{for(int i=1;i<=b.size();i++){if(i<a.size()+1){b[b.size()-i]+=a[a.size()-i]-'0';if(b[b.size()-i]>'9'){b[b.size()-i]-=10;if(b.size()-i==0){b.insert(b.begin(),'1');}else b[b.size()-i-1]+=1;}}else{if(b[b.size()-i]>'9'){b[b.size()-i]-=10;if(b.size()-i==0){b.insert(b.begin(),'1');}else b[b.size()-i-1]+=1;}}}return b;}return b;}
};