1 条题解
-
1
咦?每人发题解?那我来发一个🙂
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int n; cin >> n; string maxPinyin; int maxLength = 0; for (int i = 0; i < n; i++) { string pinyin; cin >> pinyin; int length = pinyin.length(); if (length > maxLength) { maxLength = length; maxPinyin = pinyin; } else if (length == maxLength && pinyin > maxPinyin) { maxPinyin = pinyin; } } cout << maxPinyin << endl; return 0; }
已AC,放心食用!食用完了后记得点赞哦~
- 1
信息
- ID
- 1078
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 7
- 标签
- 递交数
- 13
- 已通过
- 12
- 上传者