1427
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string input;
cin >> input;
sort(input.begin(),input.end(),greater<char>());
cout << input;
}
11004
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long input_count,solve_num,input_num;
cin >> input_count >> solve_num;
vector<long long> input_nums;
for (long long i=0;i<input_count;i++){
cin >> input_num;
input_nums.push_back(input_num);
}
sort(input_nums.begin(),input_nums.end());
cout << input_nums[solve_num-1];
}
10825
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Student{
string name;
int korean, english, math;
};
bool sorting(Student a, Student b){
if(a.korean == b.korean && a.english == b.english && a.math == b.math) return a.name < b.name;
if (a.korean == b.korean && a.english == b.english) return a.math>b.math;
if (a.korean == b.korean) return a.english<b.english;
return a.korean>b.korean;
};
int main(){
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int number_of_people;
cin >> number_of_people;
vector<Student> Stu_vec(number_of_people);
for(int i = 0; i<number_of_people ; i++){
cin >> Stu_vec[i].name >> Stu_vec[i].korean >> Stu_vec[i].english >> Stu_vec[i].math;
}
sort(Stu_vec.begin(),Stu_vec.end(),sorting);
for(int i = 0; i<number_of_people ; i++){
cout << Stu_vec[i].name << "\\n";
}
}