class Solution {
public:
typedef long long lint;
lint sToInt(const string &s) {
lint ans = 0;
for (int i = 0; i < s.length(); i++) {
ans += ((s[i] - '0') * pow(10, (s.length() - i - 1)));
}
return ans;
}
string iToStr(lint num) {
if (num == 0) return "0";
string s;
while (num) {
s += ((num % 10) + '0');
num /= 10;
}
reverse(s.begin(), s.end());
return s;
}
string multiply(string num1, string num2) {
return iToStr(sToInt(num1) * sToInt(num2));
return "";
}
};
字符串相乘
最新推荐文章于 2024-11-02 13:05:10 发布