#include<bits/stdc++.h>
using namespace std;
string b[25];
struct sb {
int a;
string b;
}a[25];
bool cmp(struct sb a,struct sb b) {
return sizeof(a)>sizeof(b);
}
int main()
{
int n;
cin>>n;
for(int i = 1; i<= n; i++)
{
cin>>a[i].b;
a[i].a = i;
b[i] = a[i].b;
}
// sort(a+1,a+n+1,cmp);
for(int i = 1; i<= n;i++)
{
for(int j = 1;j <= n;j++)
{
if(sizeof(a[i].b)<sizeof(a[j].b))
swap(a[i],a[j]);
}
}
for(int i = 1; i<= n;i++)
{
for(int j = 1;j <= n;j++)
{
if(a[i].b>a[j].b)
swap(a[i],a[j]);
}
}
for(int i = 1; i<= n; i ++)
{
cout<<a[i].b<<endl;
}
cout<<a[1].a<<endl;
cout<<a[1].b<<endl;
}
好像
是排序的问题
不知道为什么不能按照字符串长度排序
蒟蒻求问
QAQ