题意:

给n个字符串,然后将这些字符串组合,搞成一个最小字典序的字符串,然后输出就好了。

思路:

记得以前神队友给我说过你怎么将n个字符串按字典序的比较从小到大输出。那么我也是这样玩一下,然后组合输出?还行啊!!!woc,但是有点怪。。其实可以通过比较字符串的不同组合的方式,然后排序。

现在string还不熟练的童鞋,要好好玩了啊!!

code…

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const double eps=1e-6;
const double pi=acos(-1.0);
const int mod=998244353;
const int INF=0x3f3f3f3f; const int N=1e4+10;
string s[N*5]; bool cmp(string x,string y)
{
return x+y<y+x;
}
int main()
{
int n;
cin>>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];
}

codeforces 632C的更多相关文章

  1. codeforces 632C The Smallest String Concatenation

    The Smallest String Concatenation 题目链接:http://codeforces.com/problemset/problem/632/C ——每天在线,欢迎留言谈论. ...

  2. codeforces 632C. The Smallest String Concatenation 排序

    题目链接 给出n个字符串, 将他们连在一起, 求连玩之后字典序最小的那种情况. 按a+b<b+a排序.... #include <iostream> #include <vec ...

  3. CodeForces 632C The Smallest String Concatenation//用string和sort就好了&&string的基础用法

    Description You're given a list of n strings a1, a2, ..., an. You'd like to concatenate them togethe ...

  4. codeforces 632C C. The Smallest String Concatenation(sort)

    C. The Smallest String Concatenation time limit per test 3 seconds memory limit per test 256 megabyt ...

  5. CodeForces 632C Grandma Laura and Apples (模拟)

    题意:有n个人买苹果,当苹果剩余偶数时买走一半,当苹果剩余奇数时,先买走一半,再用半价买走一个苹果,最终苹果恰好卖完.农民收入为多少. 析:反向模拟. 代码如下: #pragma comment(li ...

  6. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  7. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  8. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  9. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

随机推荐

  1. [Testing] Config jest to test Javascript Application -- Part 3

    Run Jest Watch Mode by default locally with is-ci-cli In CI, we don’t want to start the tests in wat ...

  2. centos下的hadoop服务器的配置

    是我安装CentOS服务器的过程,记录下来,与大家一起分享. 安装操作系统 CentOS 6.2 ,CentOS-6.2-i386-bin-DVD1.iso(32位) ,CentOS-6.2-x86_ ...

  3. setUp() and setUpBeforeClass()

    The @BeforeClass and @AfterClass annotated methods will be run exactly once during your test run - a ...

  4. STL review:vector & string & map & struct

    I.vector 1.头文件:#include<vector>                        //容器vector是一个能实现随机存取.插入删除的动态数组,还可以当栈使. ...

  5. [转]XCode中修改缺省公司名称/开发人员名称

    本文转载至  http://www.cnblogs.com/zhulin/archive/2011/11/24/2261537.html   XCode新建文件后,头部会有开发人员名称,公司名称等信息 ...

  6. Tomcat安全配置规范

    第1章 账号管理.认证授权 1.1 账号 1.1.1 共享帐号管理 安全基线项目名称 Tomcat共享帐号管理安全基线要求项 安全基线编号 SBL-Tomcat-01-01-01 安全基线项说明   ...

  7. CentOS笔记-常用网络命令

    1.curl & wget 使用curl或wget命令,不用离开终端就可以下载文件.如你用curl,键入curl -O后面跟一个文件路径.wget则不需要任何选项.下载的文件在当前目录. cu ...

  8. 无节操cocos2d-js游戏

    1.  <看谁抽得快> 2.   <拍苍蝇> 3.   <月饼达人> 4.   <亲吻小游戏> 下面这些是本人做的,需要源代码的可以回复我 ps:全部采 ...

  9. (C)do{...}while(0);的用法及意义

    实际上,do{…}while(0)的作用远大于美化你的代码. 总结起来这样写主要有以下几点好处: 1. 辅助定义复杂的宏 避免引用的时候出错: 举例来说,假设你需要定义这样一个宏: #define D ...

  10. HDU3374 String Problem —— 最小最大表示法 + 循环节

    题目链接:https://vjudge.net/problem/HDU-3374 String Problem Time Limit: 2000/1000 MS (Java/Others)    Me ...