[Problem]
给出n和n个整数,希望你从小到大给他们排序
[Solution]
说明:版权所有,转载请注明出处。#include <vector> #include <algorithm> #include <iostream> using namespace std; int main(){ int n, a; vector<int> data; // get data cin >> n; while(n--){ cin >> a; data.push_back(a); } sort(data.begin(), data.end()); // output result for(int i = 0; i < data.size(); ++i){ if(i != 0){ cout << " "; } cout << data[i]; } cout << endl; return 0; }