# 14276: 【原4276】小可怜要排序

### 题目描述

author: 小可怜 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/4276

# 小可怜要排序

## SAMPLE INPUT 1

0
5
1 5 3 4 2


## SAMPLE OUTPUT 1

1 2 3 4 5


## SAMPLE INPUT 2

3
5
aaa bbb ccc ddd eee


## SAMPLE OUTPUT 2

eee ddd ccc bbb aaa


## Hint

sample.cpp如下：

#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;

int n = 0;
int a[1000005] = {0};
string str[1005];

//TODO
//sort

bool IncreaseInt(int x,int y) { return x < y; }
bool DecreaseInt(int x,int y) { return y < x; }
bool IncreaseString(string x, string y) { return x < y; }
bool DecreaseString(string x, string y) { return y < x; }

int main()
{
//主程序中仅此处允许添加必要的代码。其余部分不可修改。
int op;
char chh[100];
scanf("%d",&op);
switch (op)
{
case 0:
scanf("%d",&n);
for (int i=0;i<n;++i) scanf("%d",&a[i]);
sort(a,0,n-1,IncreaseInt);
for (int i=0;i<n;++i) printf("%d ",a[i]);
break;
case 1:
scanf("%d",&n);
for (int i=0;i<n;++i) scanf("%d",&a[i]);
sort(a,0,n-1,DecreaseInt);
for (int i=0;i<n;++i) printf("%d ",a[i]);
break;
case 2:
scanf("%d",&n); cin.getline(chh,90);
for (int i=0;i<n;++i) cin >> str[i];
sort(str,0,n-1,IncreaseString);
for (int i=0;i<n;++i) cout << str[i] << " ";
break;
case 3:
scanf("%d",&n); cin.getline(chh,90);
for (int i=0;i<n;++i) cin >> str[i];
sort(str,0,n-1,DecreaseString);
for (int i=0;i<n;++i) cout << str[i] << " ";
break;
}
return 0;
}


## Oops! 本题目还没有解答！

OJ翻了一新，但本解答集还大多用的是2017-2019级，甚至更早的同学们贡献的答案。