[백준] 1427번 소트인사이드 / C++
#문제
#풀이
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int N;
cin >> N;
string S = to_string(N);
sort(S.rbegin(), S.rend());
for (int i = 0; i < S.size(); ++i)
{
cout << S[i];
}
return 0;
}
#정리
입력 받은 숫자를 string으로 변환 후, 역으로 정렬하여 출력.
Enjoy Reading This Article?
Here are some more articles you might like to read next: