当前位置:网站首页>排序---
排序---
2022-06-22 16:38:00 【又是这货】
文章目录
把数组排成最小的数
添加链接描述
任何一个元素y,和它前的任何一个元素x进行有序组合形成 xy,比和他后面的任何一个元素z进行有效序列组合yz,满足条件xy < yz(字典序列排序) //如{32,31},结果{31, 32}
static bool cmp(int x, int y){
//x,y构成的序列中,小的放在前面
string xs = to_string(x); int转string字符串
string ys = to_string(y);
string A = xs; A += ys;
string B = ys; B += xs;
return A < B;
}
string PrintMinNumber(vector<int> numbers)
{
sort(numbers.begin(), numbers.end(), cmp);
string result = "";
for(unsigned int i = 0;i < numbers.size(); i++)
{
result += to_string(numbers[i]); }
return result;
}
void sort(RandomAccessIterator first,RandomAccessIterator last,Compare comp)
边栏推荐
- Parallel integrates with moonbeam through xcm, bringing para and defi use cases into moonbeam ecology
- RF analyzer demo setup
- Service or mapper cannot be injected into a multithread
- Activity启动流程梳理
- Ad20/altium Designer - oil for manhole cover
- Mybaits: interface proxy implementation Dao
- SaaS application development guide
- 利用Inkscape转换为dxf文件的正确方法 svg导出dxf文件
- How to solve the problem of database?
- MYSQL_ ERRNO : 1205 MESSAGE :Lock wait timeout exceeded; try restarting transacti
猜你喜欢

A new mode of enterprise software development: low code

clickhouse 21. X cluster four piece one copy deployment

How to do well in R & D efficiency measurement and index selection

Power BI的五个实用小技巧(文末赠书)

Binary tree practice the second bullet

Xftp 7 (ftp/sftp client) v7.0.0107 official Chinese free official version (with file + installation tutorial)

基于转换器 (MMC) 技术和电压源转换器 (VSC) 的高压直流 (HVDC) 模型(Matlab&Simulink实现)

Killed by the script, and "resurrected" by camping

DAP事实表加工汇总功能应用说明

大一女生废话编程爆火!懂不懂编程的看完都拴Q了
随机推荐
Noah fortune plans to land on the Hong Kong Stock Exchange: the performance fell sharply in the first quarter, and once stepped on the thunder "Chengxing case"
math_ Angular function & inverse trigonometric function
Kibana+elk cluster log processing
Content recommendation process
[cursor nesting] nesting of MySQL stored procedure cursors
d的dip1000,1
东华大学|具有强化知识感知推理的可解释推荐微观行为研究
跨平台Brave浏览器
Nuxt - Universal (SSR / SSG) / single page app (rendering mode)
网页制作存在的一些难点
[applet project development -- Jingdong Mall] subcontracting configuration of uni app development
Using stream API instead of SQL
How to solve the problem of database?
< JVM part I: memory and garbage collection part > 08 object instantiation and direct memory
国产手机干翻苹果?原来是靠百元机和猛降价实现的
Quickly master asp Net authentication framework identity - user registration
短视频带货源码,保存图片到相册/图库
【工具】pip和conda的相關使用
[step 1 of advanced automated testing] 1 minute to introduce you to automated testing
如何理解volatile