๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/๋ฐฑ์ค€(BOJ)

[๋ฐฑ์ค€,c++] 1427๋ฒˆ - ์†ŒํŠธ์ธ์‚ฌ์ด๋“œ

by dkswnkk 2021. 11. 6.
 

1427๋ฒˆ: ์†ŒํŠธ์ธ์‚ฌ์ด๋“œ

์ฒซ์งธ ์ค„์— ์ •๋ ฌํ•˜๋ ค๊ณ  ํ•˜๋Š” ์ˆ˜ N์ด ์ฃผ์–ด์ง„๋‹ค. N์€ 1,000,000,000๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ž์—ฐ์ˆ˜์ด๋‹ค.

www.acmicpc.net

include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

bool desc(int n1, int n2) {
    return n1 > n2;
}
int main() {
    string s;
    vector<int> v;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        v.push_back(s[i]-'0');
    }
    sort(v.begin(), v.end(), desc);

    for (int i = 0; i < v.size(); i++) {
        cout << v[i];
    }


}

๋Œ“๊ธ€