-
-
Save jwvg0425/edaf41c0bc8687fc90abbb1a3ca65db4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int to_one(int x) | |
{ | |
if(x==1) | |
return 0; | |
int ans = 1 + to_one(x-1); // 1 빼기 | |
if(x%3 == 0) | |
ans = min(ans, 1 + to_one(x/3)); | |
if(x%2 == 0) | |
ans = min(ans, 1 + to_one(x/2)); | |
return ans; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment