#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
int main(){
int n;
cin>>n;
string s;
getchar();
for(int i = 0;i < n;i++){
getline(cin,s);
vector<int>v;
int index = s.find_first_of(' ');
//根据空格进行切分
while(index > 0){
v.push_back(atoi(s.substr(0,index).c_str()));
s = s.substr(index+1,s.length());
index = s.find_first_of(' ');
}
//最后一个前面没有空格,需要单独处理
v.push_back(atoi(s.substr(0,s.length()).c_str()));
sort(v.begin(),v.end());
for(int j = 0;j < v.size();j++){
if(j == v.size()-1){
cout<<v[j]<<endl;
}else{
cout<<v[j]<<" ";
}
}
}
return 0;
}
2017年西北工业大学机试真题第二题
猜你喜欢
转载自blog.csdn.net/PriestessofBirth/article/details/105174935
今日推荐
周排行