cf#ECR 9-C - The Smallest String Concatenation-水题
来源:互联网 发布:windows 2003 编辑:程序博客网 时间:2024/06/05 20:16
http://codeforces.com/contest/632/problem/C
给n个字符串,要求拼接起来得到的串字典序最小
一开始在想怎么搞。。后来发现这个规模无脑暴力一发即可
#include <cstdio>#include <cmath>#include <cstring>#include <string>#include <algorithm>#include <queue>#include <map>#include <set>#include <vector>#include <iostream>using namespace std;const double pi=acos(-1.0);double eps=0.000001; int min(int a,int b){return a<b?a:b;} struct node {char s[55];bool operator< (const node b){string s1,s2;s1=s;s1+=b.s;s2=b.s; s2+=s; if (s1<s2)return true;elsereturn false;} }; node tm[5*10000+50]; int main(){int n;cin>>n;int i;for (i=1;i<=n;i++){scanf("%s",tm[i].s);}sort(tm+1,tm+1+n);for (i=1;i<=n;i++){printf("%s",tm[i].s);}printf("\n");return 0;}
0 0
- cf#ECR 9-C - The Smallest String Concatenation-水题
- C. The Smallest String Concatenation
- Educational Codeforces Round 9 -- C - The Smallest String Concatenation
- Educational Codeforces Round 9 C The Smallest String Concatenation
- Educational Codeforces Round 9 C. The Smallest String Concatenation【思维】
- codeforces--623C The Smallest String Concatenation
- Codeforces 632C - The Smallest String Concatenation
- CodeForces-632C-The Smallest String Concatenation
- CodeForces 632C The Smallest String Concatenation
- Codeforce 632C The Smallest String Concatenation
- CodeForces 632C The Smallest String Concatenation
- The Smallest String Concatenation
- Codeforces 632C The Smallest String Concatenation 【string】
- The Smallest String Concatenation CodeForces
- The Smallest String Concatenation CodeForces
- codeforces 632C C The Smallest String Concatenation(排序)
- C. The Smallest String Concatenation-C++sort排序~~
- CodeForces 632C C. The Smallest String Concatenation
- HDU 4549 M斐波那契数列(矩阵快速幂&费马小定理)
- maven 相关命令记录
- 程序员必须知道的10大基础实用算法及其讲解
- cf#ECR 9-B. Alice, Bob, Two Teams-DP
- 边看书边做边发挥-图书软件-3
- cf#ECR 9-C - The Smallest String Concatenation-水题
- 143 php 接口
- JAVA二学(二)剖析String
- cf#ecr9-D - Longest Subsequence
- 个人进阶之路——安卓蓝牙模块(3)
- 程序员必须知道的10大基础实用算法及其讲解
- 关于swift中约束会有的一些冲突解决
- 部分客户端设备支持的IPSec提议集
- 判断一个数组是另一数组的子集