You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
641 B
32 lines
641 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
const int N = 30;
|
|
|
|
struct Person {
|
|
string x;
|
|
int num;
|
|
} a[N];
|
|
|
|
bool cmp(const Person &a, const Person &b) {
|
|
if (a.x.size() == b.x.size()) {
|
|
for (int i = 0; i < a.x.size(); i++) {
|
|
if (a.x[i] != b.x[i]) return a.x[i] > b.x[i];
|
|
}
|
|
return true;
|
|
} else
|
|
return a.x.size() > b.x.size();
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i].x;
|
|
a[i].num = i;
|
|
}
|
|
sort(a + 1, a + n + 1, cmp);
|
|
printf("%d\n%s", a[1].num, a[1].x.c_str());
|
|
return 0;
|
|
} |