当前位置:网站首页>1038 recover the smallest number (30 points)
1038 recover the smallest number (30 points)
2022-07-22 20:33:00 【Konjaku for learning programming】
1038 Recover the Smallest Number (30 branch )
Update ideas when available
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool cmp(string a, string b){
return a + b < b + a;
}
int main() {
int n;
cin >> n;
vector<string> v(n);
for(int i = 0; i < n; ++i)
cin >> v[i];
sort(v.begin(), v.end(), cmp);
string s;
for(int i = 0; i < n; ++i)
s += v[i];
while(s[0] == '0')
s.erase(s.begin());
cout << s;
if(s.length() == 0) cout << 0;
}
边栏推荐
- json按格式逐行输出到文件
- vim 使用tips
- Dense passage retrieval for open domain question answering notes
- Unix C语言 POSIX 互斥锁 线程同步
- 她力量系列四丨读博6年两次换导师,靠一点点“倔”,俞舟成为social chatbot的开拓者之一
- Vim学习之旅
- Pytorch dynamically adjusts the learning rate, and the learning rate automatically decreases according to loss
- Unix C语言POSIX的线程创建、获取线程ID、汇合线程、分离线程、终止线程、线程的比较
- Classic cases of semaphore synchronization and mutual exclusion
- 【文献阅读与想法笔记14】Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising
猜你喜欢
本地镜像发布到私有库
LeetCode160 & LeetCode141——double pointers to solve the linked list
Mise en œuvre de la pile de chaînes (langage c)
docker搭建mysql主从复制
Canny based subpixel severity algorithm
Introduction to machine learning: support vector machine-6
她力量系列七丨兰艳艳:理想温暖10年科研路,女性可以柔和,更要自信、专业 | 妇女节特辑
pytorch 动态调整学习率,学习率自动下降,根据loss下降
Kubernetes基础入门
LeetCode0022——括号生成——DFS
随机推荐
1080 Graduate Admission (30 分)
1087 All Roads Lead to Rome (30 分)
Stack implementation (C language)
1038 Recover the Smallest Number (30 分)
16进制字符串与字节数组之间的转换
redission看门狗实现机制一看就懂
c语言bitField
机器学习入门:线性回归-1
八大排序(直接插入排序)
canny边缘检测
LeetCode912——sort an array—— quick sort algorithm
RP file Chrome browser view plug-in
Leetcode206 - reverse linked list
SSM框架整合
Vscade turn off automatic updates
Pre training weekly 39: deep model, prompt learning
LeetCode21——Merge two sorted lists——Iteration or recursion
笔记:C语言
AMBert
mysql引擎