CodeForces 632C The Smallest String Concatenation
来源:互联网 发布:阿里云手机助手apk 编辑:程序博客网 时间:2024/06/10 06:28
题意:给定几个串,问如何组合起来使得字典序最小
思路:直接排个序就搞定了
#include <cstdio>#include <queue>#include <cstring>#include <iostream>#include <cstdlib>#include <algorithm>#include <vector>#include <map>#include <string>#include <set>#include <ctime>#include <cmath>#include <cctype>using namespace std;const int maxn = 50000+1000;#define LL long longint cas=1,T;string s[maxn];bool cmp(string a,string b){string aa = a+b;string bb = b+a;return aa<bb;}int main(){int n;scanf("%d",&n);for (int i = 0;i<n;i++)cin >> s[i];sort(s,s+n,cmp);for (int i = 0;i<n;i++)cout << s[i];cout << endl;//freopen("in","r",stdin);//scanf("%d",&T);//printf("time=%.3lf",(double)clock()/CLOCKS_PER_SEC);return 0;}
0 0
- 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 632C C. The Smallest String Concatenation
- codeforces--623C The Smallest String Concatenation
- codeforces 632C The Smallest String Concatenation【巧妙的排序】
- CodeForces 632C The Smallest String Concatenation 排序
- CodeForces 632 C.The Smallest String Concatenation(水~)
- codeforces 632C 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
- 核心动画的结构
- 第五周项目二游戏中的角色类2
- 第五周项目 1-三角形类雏形
- UML类图几种关系的总结(收藏)
- CAlayer的疑惑
- CodeForces 632C The Smallest String Concatenation
- 我要写代码——跨过程序员的门槛(3)
- 年龄(穷举法)
- 获取当前的时间
- 不让未成年人看的11张世界地图!反正,我是看傻了
- Ubuntu 上NFS Server安装使用过程
- struts1的actionform
- 第五周项目训练1 三角形类3
- 定时器,在scrollView滑动的时候,定时器nstimer会暂定回调的解决办法