#include #include using namespace std; int main() { int m, n; cin >> m >> n; string s1 = to_string(m); string s2 = to_string(n); int len1 = s1.length(); int len2 = s2.length(); int len = len1 + len2; int* res = new int[len]{0}; for (int i = len1 - 1; i >= 0; i--) { int a = s1[i] - '0'; for (int j = len2 - 1; j >= 0; j--) { int b = s2[j] - '0'; res[i + j + 1] += a * b; res[i + j] += res[i + j + 1] / 10; res[i + j + 1] %= 10; } } for (int i = 0; i < len; i++) { cout << res[i] << endl; } delete[] res; return 0;


原文地址: https://www.cveoy.top/t/topic/is5S 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录