#1427
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
int cnt = 0;
int num[10];
cin >> n ;
while(n/10 != 0)
{
num[cnt] = n%10;
n /= 10;
cnt++;
}
num[cnt] = n%10;
sort(num, num+cnt+1);
for(int i=cnt; i>=0; i--)
{
cout << num[i];
}
return 0;
}
#11004
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n,k, num;
int* arr = nullptr;
cin >> n >> k;
arr = new int[n];
for(int i=0; i<n; i++)
{
cin >> num;
arr[i] = num;
}
sort(arr, arr+n);
cout << arr[k-1] << endl;
}
#10825
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct STU{
string name;
int kor, eng, math;
};
bool cmp(STU a, STU b) {
if (a.kor == b.kor && a.eng == b.eng && a.math == b.math)
return a.name < b.name;
if (a.kor == b.kor && a.eng == b.eng)
return a.math > b.math;
if (a.kor == b.kor)
return a.eng < b.eng;
return a.kor > b.kor;
}
int main() {
int N;
cin >> N;
vector<STU> v(N);
for (int i=0; i<N; i++)
cin >> v[i].name >> v[i].kor >> v[i].eng >> v[i].math;
sort(v.begin(), v.end(), cmp);
for (int i = 0; i < N; i++)
cout << v[i].name << '\\n';
return 0;
}