CodeForces 632C The Smallest String Concatenation 排序
来源:互联网 发布:如何跟淘宝达人合作 编辑:程序博客网 时间:2024/06/07 12:11
解法很简单,排序+输出。
bool cmp(string c,string d){ x=c+d; y=d+c; return x<y;}
排序方法:
#include<bits/stdc++.h>using namespace std;#define all(x) (x).begin(), (x).end()#define for0(a, n) for (int (a) = 0; (a) < (n); (a)++)#define for1(a, n) for (int (a) = 1; (a) <= (n); (a)++)typedef long long ll;typedef pair<int, int> pii;const int INF =0x3f3f3f3f;const int maxn=50000 ;string a[maxn+10];int n;string x,y;bool cmp(string c,string d){ x=c+d; y=d+c; return x<y;}int main(){ while(cin>>n) { for1(i,n) { cin>>a[i]; } sort(a+1,a+1+n,cmp); for1(i,n) { cout<<a[i]; } cout<<endl; } return 0;}
0 0
- codeforces 632C C The Smallest String Concatenation(排序)
- codeforces 632C The Smallest String Concatenation【巧妙的排序】
- CodeForces 632C The Smallest String Concatenation 排序
- codeforces 632C The Smallest String Concatenation 排序
- Codeforces 632C - The Smallest String Concatenation
- CodeForces-632C-The Smallest String Concatenation
- CodeForces 632C The Smallest String Concatenation
- CodeForces 632C The Smallest String Concatenation
- Codeforces 632C The Smallest String Concatenation 【string】
- CodeForces 632C C. The Smallest String Concatenation
- codeforces--623C The Smallest String Concatenation
- CodeForces 632 C.The Smallest String Concatenation(水~)
- The Smallest String Concatenation CodeForces 632C 字符串
- The Smallest String Concatenation CodeForces
- The Smallest String Concatenation CodeForces
- Codeforce 632C The Smallest String Concatenation
- C. The Smallest String Concatenation
- Educational Codeforces Round 9 C. The Smallest String Concatenation(字符串排序)
- 100. Same Tree
- Android基于http协议多文件上传
- Effective C++ -- Item 1: View c++ as a federation of languages
- c++第四次上机-6
- CaffeOnSpark in Ubuntu 15.04
- CodeForces 632C The Smallest String Concatenation 排序
- zoj-3923- In the Rain
- 练习二1012
- 网络:NSURLSession 下载暂停与继续
- 框架模式 MVC 在Android中的使用
- Codeforces Round #309 (Div. 2) D - Kyoya and Permutation ,和dp相关的xjb搞的题
- win7 microsoft iis配置(2)
- hdu-4545-魔法串
- TOJ : 2844.Emergency Mission