#include #include #include using namespace std; const int MAX=1005; int main() { int x[MAX]={0},y[MAX]={0},z[2*MAX+1]={0}; string a,b; cin>>a>>b; reve... ...
#include <iostream> #include <string> #include <algorithm> using namespace std; const int MAX=1005; int main() { int x[MAX]={0},y[MAX]={0},z[2*MAX+1]={0}; string a,b; cin>>a>>b; reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); int i,j; for(i=0;i<a.length();i++) x[i]=a[i]-'0'; for(i=0;i<b.length();i++) y[i]=b[i]-'0'; for(i=0;i<a.length();i++) for(j=0;j<b.length();j++) z[i+j]=z[i+j]+x[i]*y[j]; for(i=0;i<MAX*2;i++) { if(z[i]>=10) { z[i+1]+=z[i]/10; z[i]=z[i]%10; } } for(i=MAX*2;i>0;i--) { if(z[i]==0) continue; else break; } for(;i>=0;i--) cout<<z[i]; return 0; }