#字符串排序#__huawei_no.14-2
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin>>n; vector<string>str; string s; for(int i = 0; i < n; i++){ cin>>s; str.push_back(s); } sort(str.begin(),str.end()); for(int i = 0 ; i < n ; i++){ cout<<str[i]<<endl; } return 0; } // 64 位输出请用 printf("%lld")
显然用sort才是更好的。