热帖湖北配偶VS大户v和大部分都会发红包

鸡你太美  •  3个月前


include using namespace std; int a[10005], b[10005], c[20005]; int main() { string s1, s2; cin >> s1 >> s2; for (int i = 0; i < s1.size(); i++) a[s1.size() - 1 - i] = s1[i] - '0'; for (int i = s2.size() - 1; i >= 0; i--) b[s2.size() - 1 - i] = s2[i] - '0'; for (int i = 0; i < s1.size(); i++) { for (int j = 0; j < s2.size(); j++) { c[i + j] += a[i] * b[j]; } } for (int i = 0; i < s1.size() + s2.size(); i++) { c[i + 1] += c[i] / 10; c[i] = c[i] % 10; } int l = s1.size() + s2.size(); if (c[l - 1] == 0) l--; for (int i = l - 1; i >= 0; i--) cout << c[i]; return 0; }


评论:

请先登录,才能进行评论