国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

1038. Recover the Smallest Number (30)

2019-11-14 12:30:14
字體:
供稿:網(wǎng)友

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; else while(it!=ans.end()) { cout<<*it;++it; } return 0;}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 洪湖市| 永春县| 德清县| 沈丘县| 唐海县| 得荣县| 凤城市| 阳东县| 大渡口区| 华坪县| 武山县| 昌邑市| 建始县| 广州市| 镇康县| 淮北市| 阳曲县| 庄浪县| 平阴县| 镶黄旗| 明星| 澄江县| 宜黄县| 哈巴河县| 波密县| 南城县| 若尔盖县| 扶风县| 平果县| 卢龙县| 海盐县| 芒康县| 枞阳县| 桦南县| 图们市| 涞水县| 桐梓县| 寻甸| 舟山市| 雅江县| 体育|