(1)根据键盘的值输入数组
int N;
cin >> N;
vector<int> num(N, 0);
for (int i = 0; i < N; ++i){ cin >> num[i]; }
sort(num.begin(), num.end());//从小到大排序
(2)
bool sort_cmp(const pair<int, int> &A, const pair<int, int> &B)
{ return A.first == B.first ? A.second < B.second :
A.first < B.first; }