@[Zichen14](/user/1216519) 代码?
by __wangboyue__ @ 2023-12-24 14:02:22
(个人中心理查我源代码 P1781)
by Zichen14 @ 2023-12-24 14:02:35
@[__wangboyue__](/user/740325) 个人中心
by Zichen14 @ 2023-12-24 14:03:28
@[Zichen14](/user/1216519) 怎么查找?
by xiaoshumiao @ 2023-12-24 14:12:08
(俺不会发代码)
by Zichen14 @ 2023-12-24 14:19:54
@[Zichen14](/user/1216519) [Markdown](https://help.luogu.com.cn/rules/academic/handbook/markdown)
by xiaoshumiao @ 2023-12-24 14:28:27
哦哦哦
by Zichen14 @ 2023-12-24 21:38:12
```cpp
#include <bits/stdc++.h>
using namespace std;
struct man
{
string s;
int hao;
}a[25];
bool cmp(man x, man y)
{
return x.s > y.s;
}
int main()
{
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
cin >> a[i].s;
a[i].hao = i;
}
sort(a + 1, a + n + 1, cmp);
cout << a[1].hao << endl << a[1].s;
}
by Zichen14 @ 2023-12-24 21:38:58
好了
by Zichen14 @ 2023-12-24 21:39:16
@[Zichen14](/user/1216519)
先比s.size(),因为string的比较是先比字典序,也就是先比第一位而不是长度。
by Mark_Zhu @ 2024-01-22 10:23:41