提交时间:2025-12-26 15:39:38

运行 ID: 78340

#include <iostream> #include <string> #include <algorithm> std::string multiply(const std::string& high, int low) { std::string result; int carry = 0; for (int i = high.size() - 1; i >= 0; --i) { int mul = (high[i] - '0') * low + carry; result += (mul % 10 + '0'); carry = mul / 10; } while (carry) { result += (carry % 10 + '0'); carry /= 10; } std::reverse(result.begin(), result.end()); return result; } int main() { std::string high; int low; std::cin >> high >> low; std::cout << multiply(high, low) << std::endl; return 0; }