寻找超大数字中的最大值
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 }