-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Silver V] Title: 소트인사이드, Time: 0 ms, Memory: 2028 KB -BaekjoonHub
- Loading branch information
1 parent
992db54
commit 7c54844
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# [Silver V] 소트인사이드 - 1427 | ||
|
||
[문제 링크](https://www.acmicpc.net/problem/1427) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 2028 KB, 시간: 0 ms | ||
|
||
### 분류 | ||
|
||
정렬, 문자열 | ||
|
||
### 제출 일자 | ||
|
||
2024년 1월 29일 17:55:07 | ||
|
||
### 문제 설명 | ||
|
||
<p>배열을 정렬하는 것은 쉽다. 수가 주어지면, 그 수의 각 자리수를 내림차순으로 정렬해보자.</p> | ||
|
||
### 입력 | ||
|
||
<p>첫째 줄에 정렬하려고 하는 수 N이 주어진다. N은 1,000,000,000보다 작거나 같은 자연수이다.</p> | ||
|
||
### 출력 | ||
|
||
<p>첫째 줄에 자리수를 내림차순으로 정렬한 수를 출력한다.</p> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <iostream> | ||
#include <queue> | ||
#include <algorithm> | ||
#include <map> | ||
|
||
using namespace std; | ||
|
||
string str; | ||
map<char, int, greater<int>> checks; | ||
|
||
int main() | ||
{ | ||
cin >> str; | ||
|
||
for (auto ch : str) | ||
checks[ch]++; | ||
|
||
string answer; | ||
for (auto& ch : checks) | ||
answer += string(ch.second, ch.first); | ||
|
||
cout << answer; | ||
return 0; | ||
} |