https://programmers.co.kr/learn/courses/30/lessons/12899#
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solution(int n) {
string answer = "";
while (n > 0) {
if (n % 3 == 0) {
answer = "4" + answer;
n = n / 3 - 1;
}
else {
answer = to_string(n % 3) + answer;
n /= 3;
}
}
return answer;
}
#include<iostream>
#include<vector>
using namespace std;
string change124(int no)
{
string answer = "";
int a;
while(no > 0){
a = no % 3;
no = no / 3;
if (a == 0){
no -= 1;
}
answer = "412"[a] + answer;
}
return answer;
}
int main()
{
int testNo = 6;
string testAnswer = change124(testNo);
cout<<testAnswer;
}