1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() { 5 int n, c=1; 6 cin >> n; 7 string max, temp; 8 cin >> max; 9 for (int i = 2; i <= n; i++) { 10 cin >> temp; 11 if (max.size() < temp.size() || (max.size() == temp.size() && max < temp)) { 12 c = i; 13 max = temp; 14 } 15 } 16 cout << c << endl << max; 17 return 0; 18 }
原文地址:https://www.cnblogs.com/zyyz1126/p/11757636.html
时间: 2024-10-16 16:40:15