BOJ - 1427 - 소트인사이드
문제

SOL
- 문자열 변환- std::string - to_string(num)
 
- 내림차순 정렬- sort(temp.rbegin(), temp.rend());
 
구현
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<iostream>
#include<string>
#include<algorithm>
using namespace std; 
string solution(int num)
{
    string temp = to_string(num);
    sort(temp.rbegin(), temp.rend());
    return temp;
}
int main()
{
    int num;
    cin >> num;
    cout << solution(num) << endl;
    return 0; 
}
