题目链接

给出n个字符串, 将他们连在一起, 求连玩之后字典序最小的那种情况。

按a+b<b+a排序....

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define pb(x) push_back(x)
#define ll long long
#define mk(x, y) make_pair(x, y)
#define lson l, m, rt<<1
#define mem(a) memset(a, 0, sizeof(a))
#define rson m+1, r, rt<<1|1
#define mem1(a) memset(a, -1, sizeof(a))
#define mem2(a) memset(a, 0x3f, sizeof(a))
#define rep(i, n, a) for(int i = a; i<n; i++)
#define fi first
#define se second
typedef pair<int, int> pll;
const double PI = acos(-1.0);
const double eps = 1e-;
const int mod = 1e9+;
const int inf = ;
const int dir[][] = { {-, }, {, }, {, -}, {, } };
string s[];
bool cmp(string a, string b) {
return a+b<b+a;
}
int main()
{
int n;
cin>>n;
for(int i = ; i<n; i++)
cin>>s[i];
sort(s, s+n, cmp);
for(int i = ; i<n; i++)
cout<<s[i];
cout<<endl;
return ;
}

codeforces 632C. The Smallest String Concatenation 排序的更多相关文章

  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//用string和sort就好了&&string的基础用法

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

  3. Educational Codeforces Round 9 C. The Smallest String Concatenation 排序

    C. The Smallest String Concatenation 题目连接: http://www.codeforces.com/contest/632/problem/C Descripti ...

  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. Educational Codeforces Round 9 C. The Smallest String Concatenation(字符串排序)

    You're given a list of n strings a1, a2, ..., an. You'd like to concatenate them together in some or ...

  6. Educational Codeforces Round 9 C. The Smallest String Concatenation —— 贪心 + 字符串

    题目链接:http://codeforces.com/problemset/problem/632/C C. The Smallest String Concatenation time limit ...

  7. C. The Smallest String Concatenation

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

  8. C. The Smallest String Concatenation-C++sort排序~~

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

  9. 【LeetCode】988. Smallest String Starting From Leaf 解题报告(C++ & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 DFS BFS 日期 题目地址:https://le ...

随机推荐

  1. js的this几种用法

    1.普通的函数调用 此时指的是全局对象 function aaa(){ this.x=1;}aaa();alert(x) 2.对象内的方法this调用 此时指的是上一级对象 var aaa={ zz: ...

  2. JavaScript小知识点(一)

     JavaScript 有3种方式定义对象 ①  var i = { function-x:function{ //todo }}; 这是通过Json方式定义一个函数对象. ②  function P ...

  3. matlab差分算法

    今天实现了<一类求解方程全部根的改进差分进化算法>(by 宁桂英,周永权),虽然最后的实现结果并没有文中分析的那么好,但是本文依然是给了一个求解多项式全部实根的基本思路.思路是对的,利用了 ...

  4. CCF计算机认证——字符串匹配问题(运行都正确,为什么提交后只给50分?)

    我的程序: #include<iostream> #include<cctype> #include<string> #include<vector> ...

  5. mysql学习(三)

    //解决linux下不能远程登陆的方法 http://www.blogjava.net/jasmine214--love/archive/2011/01/14/342981.html mysql数据类 ...

  6. iOS下移除按钮原生样式

    按钮样式,在 Android 手机浏览器中显示正常,但在 iOS Safari 浏览器中会看到按钮显示为圆角样式,设置 border-radius:0; 也不好使. 这是因为iPhone.iPad 设 ...

  7. 通过SocketLog快速分析php程序

    转载自http://www.thinkphp.cn/topic/10846.html 正在运行的API有bug,不能var_dump进行调试,因为会影响client的调用.这时候用SocketLog最 ...

  8. 利用VHDL读写file文件

    library ieee;     use std.textio.all;     use ieee.std_logic_textio.all;     use ieee.std_logic_1164 ...

  9. Protection 5 ---- Priviliege Level Checking 2

    CPU不仅仅在程序访问数据段和堆栈段的时候进行权限级别检查,当程序控制权转换的时候也会进行权限级别检查.程序控制权转换的情况很多,各种情况下检查的方式以及涉及到的检查项都是不同的.这篇文章主要描述了各 ...

  10. [Leetcode][Python]30: Substring with Concatenation of All Words

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com' 30: Substring with Concatenation of All ...