[UVA-11039]Children's Game

Posted alessandro

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[UVA-11039]Children's Game相关的知识,希望对你有一定的参考价值。

解析

微扰法贪心经典题

代码

#include <bits/stdc++.h>
using namespace std;

bool cmp(const string &x, const string &y) {
    return x + y > y + x;
}

int main() {
    int n;
    while (~scanf("%d", &n) && n) {
        string str[55];
        for (int i = 1; i <= n; ++ i) cin >> str[i];
        sort(str + 1, str + n + 1, cmp);
        for (int i = 1; i <= n; ++ i) cout << str[i];
        putchar(10);
    }
}

以上是关于[UVA-11039]Children's Game的主要内容,如果未能解决你的问题,请参考以下文章

[UVA - 11039] Building designing 题解

UVa 11039 Building designing (贪心+排序+模拟)

UVA - 11039 B - Building designing

UVA10905 Children's Game

贪心:Children's Game UVA - 10905

pom文件出现Element 'xxxxxxx' cannot have character [children],because the type's content typ