日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

1038. Recover the Smallest Number (30)

發(fā)布時(shí)間:2024/4/17 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 1038. Recover the Smallest Number (30) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1038. Recover the Smallest Number (30)
進(jìn)行排序,注意comp的寫法;

#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; bool comp(const string &a,const string &b) {return a+b<b+a; } int main() {vector<string> v;int n;cin>>n;for(int i=0;i!=n;++i){string temp;cin>>temp;v.push_back(temp);}sort(v.begin(),v.end(),comp);string ans;for(auto it=v.begin();it!=v.end();++it)ans+=*it;auto it=ans.begin();while(it!=ans.end()&&(*it)=='0')++it;if(it==ans.end())cout<<0;elsewhile(it!=ans.end()){cout<<*it;++it;}return 0; }

轉(zhuǎn)載于:https://www.cnblogs.com/xLester/p/7570359.html

總結(jié)

以上是生活随笔為你收集整理的1038. Recover the Smallest Number (30)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。