标签:class blog code 2014 string os
非常巧妙的题目,巧用cmp,注意cmp的重载
#include <iostream> #include <algorithm> using namespace std; string a[55]; bool cmp(string a, string b){ return a+b > b+a; } int main(int argc, char const *argv[]) { int n; while(cin >> n && n){ for(int i = 0; i < n; i++) cin >> a[i]; sort(a,a+n,cmp); for(int i = 0; i < n; i++) cout << a[i]; cout << endl; } return 0; }
uva Children's Game,布布扣,bubuko.com
标签:class blog code 2014 string os
原文地址:http://blog.csdn.net/sina012345/article/details/29429121