j*****s 发帖数: 189 | 1 class Solution {
public:
string intToRoman(int num) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
string s;
s += toRoman(num / 1000, "", "", "M");
s += toRoman(num / 100 % 10, "M", "D", "C");
s += toRoman(num / 10 % 10, "C", "L", "X");
s += toRoman(num % 10, "X", "V", "I");
return s;
}
string toRoman(int val, string ten... 阅读全帖 |
|