当前位置:网站首页>1038 Recover the Smallest Number (30 分)
1038 Recover the Smallest Number (30 分)
2022-07-22 10:33:00 【学编程的蒟蒻】
1038 Recover the Smallest Number (30 分)
思路有空更新
#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;
}
边栏推荐
- 百度首页被tn劫持的办法有那些、两种解决百度劫持的方法
- Introduction to machine learning: Logistic regression-2
- LeetCode0022——括号生成——DFS
- LeetCode0003——longest substring without repeating characters——Sliding Window
- redission分布式锁种类
- Introduction to machine learning: support vector machine-6
- 她力量系列八丨陈丹琦:我希望女生能够得到更多的机会,男生和女生之间的gap会逐渐不存在的
- Dense passage retrieval for open domain question answering notes
- Class template parsing
- LeetCode32——next permutation
猜你喜欢
Dense passage retrieval for open domain question answering notes
深入理解mmap函数
Leetcode0022 - bracket generation - DFS
What is the meaning of DNS hijacking, the principle of DNS hijacking and several solutions
What are the definitions and principles of domain name hijacking and the solutions to domain name hijacking
LeetCode53——Maximum Subarray——3 different methods
Comment le détournement de DNS peut - il être parfaitement réparé? Comment résoudre le problème du détournement de DNS
机器学习入门:线性回归-1
Websites jump inexplicably. What is website hijacking from Baidu? DNS hijacking (domain name hijacking) what is DNS hijacking
LeetCode160 & LeetCode141——double pointers to solve the linked list
随机推荐
数据从一台Mysql传输到另一台Mysql
On the horizontal trigger and edge trigger of epoll
LeetCode0003——longest substring without repeating characters——Sliding Window
本地镜像发布到私有库
LeetCode21——Merge two sorted lists——Iteration or recursion
Mockito3.8 如何mock静态方法 (如何mock PageHelper)
The well-known software adsafe conceals malicious code to hijack traffic from many websites
Mysql连接失败解决方案
Guidelines for installation and use of Damon database
vim 使用tips
json按格式逐行输出到文件
IDEA 隐藏.idea文件夹 隐藏.iml文件
《强化学习周刊》第39期:近似最优深度、多智能体广义、角色动画强化学习
类模板剖析
SSM框架整合
Deep understanding of MMAP function
When using CV2 to realize face recognition, Chinese is displayed on the recognition frame
mysql引擎
7-3 Size of Military Unit (25 分)
druid加密命令