UVA10905
来源:互联网 发布:智程网络怎么样 编辑:程序博客网 时间:2024/06/06 09:48
题目的意思就是给出几个数字,然后组合,像12 ,34两个数字,可以组成1234 ,3412 , 3412比较大,就是要问组成最大的是哪个;
把每个数字存成string ,排个序。输出就行,但是注意的是9,90 。。990 ,就比909大,所以写排序函数的时候要注意一点。。
AC代码:
#include<iostream>#include<algorithm>using namespace std;const int N = 50 + 5;int num ;string str[N];int cmp (string a ,string b) {return a + b > b + a;}int main () {while (cin >> num && num) {for (int i = 0 ;i < num ;i++) {cin >> str[i];}sort(str , str + num ,cmp);for (int i = 0 ; i < num ;i++) {cout << str[i];}cout << endl;}return 0;}
0 0
- uva10905
- UVA10905
- uva10905
- uva10905
- Uva10905
- UVA10905
- uva10905
- uva10905
- uva10905
- uva10905
- uva10905
- UVa10905
- uva10905 - Children's Game
- Uva10905 Children's Game
- uva10905-Children's Game
- UVA10905- Children's Game
- UVA10905 - Children's Game
- UVA10905孩子们的游戏
- GA 跨域追踪
- Oracle 层次查询(Connect By)
- 微信公众平台消息类型处理php版(方蓓工作室)
- 【卡特兰数】【数论】
- Reverse Nodes in k-Group leetcode
- UVA10905
- HBase性能优化方法总结
- 【面试准备】堆排
- HBase key设置加快查询速度小谈
- poj 1861 Network
- 优化hbase的查询操作-大幅提升读写速率
- mysql数据库连接池配置
- 1080 - Binary Simulation[树状数组]
- Binder框架及运用详解