两个语句 不明白 return c1!=c2?c1<c2:c1<c2; cin.clear();
return c1!=c2?c1<c2:c1<c2;cin.clear();
//这两个什么意思
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
bool comp(const string &s1,const string &s2)
{
int i,j,k,m,n;
int c1=0,c2=0;
for(i=0;i<s1.size();i++)
{
for(j=i+1;j<s1.size();j++)
{
if(s1[i]>s1[j])
c1++;
}
}
for(i=0;i<s2.size();i++)
{
for(j=i+1;j<s2.size();j++)
{
if(s2[i]>s2[j])
c2++;
}
}
return c1!=c2?c1<c2:c1<c2;
}
int main()
{
string s;
vector<string> v;
int n,a,b;
cin>>n;
int i,j,k;
int p=0;
for(i=0;i<n;i++)
{
cin.clear();
cin>>a>>b;
v.clear();
p++;
for(j=0;j<b;j++)
{
cin>>s;
v.push_back(s);
}
sort(v.begin(),v.end(),comp);
if(p!=1) cout<<endl;
for(k=0;k<v.size();k++)
{
cout<<v[k]<<endl;
}
}
return 0;
}