1
class Solution {
2
public:
3
string thousandSeparator(int n) {
4
string s = "";
5
int a = 0;
6
if (n == 0) return "0";
7
while (n > 0) {
8
s += char(n % 10 + 48);
9
a++;
10
n /= 10;
11
if (a == 3 && n != 0) {
12
a = 0;
13
s += ".";
14
}
15
}
16
reverse(s.begin(), s.end());
17
return s;
18
}
19
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0