输出共N行,按字典序从小到大输出。
用STL的string容易解决。
한국어< 中文 فارسی English ไทย All Copyright Reserved 2010-2011 SDUSTOJ TEAM GPL2.0 2003-2011 HUSTOJ Project TEAM Anything about the Problems, Please Contact Admin:admin
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { int N; cin >> N; vector <string> p; for(int i = 0; i < N; i++) { string t; cin >> t; p.push_back(t); } sort(p.begin(),p.end()); vector <string> :: iterator ite; for(ite = p.begin(); ite != p.end(); ite++) cout << *ite<< endl; }