提交时间:2023-10-10 13:52:22

运行 ID: 106256

#include <bits/stdc++.h> using namespace std; int c[114514]; signed main() { string a,b,a_,b_; int n; cin >> a_ >> b_; for(int i = a_.length()-1; i >= 0; i--) { a += a_[i]; } for(int i = b_.length()-1; i >= 0; i--) { b += b_[i]; } if(a_.length()>b_.length()) { for(int i = 1; i <= a_.length()-b_.length(); i++)b+='0'; } if(b_.length()>a_.length()) { for(int i = 1; i <= b_.length()-a_.length(); i++)a+='0'; } n = a.length(); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { c[i+j]+=(b[i]-'0')*(a[j]-'0'); c[i+j+1]+=c[i+j]/10; c[i+j]%=10; } } if(c[n]) { n++; } for(int i = n-1; i >= 0; i--) { cout << c[i]; } return 0; }