题目:
代码:
#include<bits/stdc++.h>
using namespace std;
struct node{
int num;
string grade;
} nn[20];
bool cmp(node x, node y){
int c;
int i=x.grade.length()-1,j=y.grade.length()-1;
if(i>j) return 1;
if(i<j) return 0;
for(i=0,j=0;;i++,j++)
{
if(x.grade[i]>y.grade[j]) return 1;
if(x.grade[i]<y.grade[j]) return 0;
}
}
int main()
{
int m;
cin>>m;
for(int i=0;i<m;i++)
{
cin>>nn[i].grade;
nn[i].num=i+1;
}
sort(nn,nn+m,cmp);
cout<<nn[0].num<<endl;
cout<<nn[0].grade;
}