PAT a1038题解
来源:互联网 发布:淘宝图片ps教程视频 编辑:程序博客网 时间:2024/05/29 21:30
#include <iostream>#include <cstdio>#include <string>#include <algorithm>using namespace std;const int maxn = 10010;string str[maxn];bool cmp(string a, string b){return a + b < b + a;}int main(){int n;cin >> n;for(int i = 0; i < n; i++){cin >> str[i];} sort(str, str + n, cmp);string ans;for(int i = 0; i < n; i++){ans += str[i];}while(ans.size() != 0 && ans[0] == '0'){ans.erase(ans.begin());}if(ans.size() == 0) cout << 0;else cout << ans;return 0;}
阅读全文
1 0
- PAT a1038题解
- PAT A1038
- PAT-A1038
- pat-a1038. Recover the Smallest Number (30)
- PAT A1038 recover the smallest number (30)
- PAT甲级练习题A1038. Recover the Smallest Number (30)
- 贪心算法--PAT.A1038.Recover the Smallest Number
- PAT A1038 Recover the Smallest Number 算法问题和关于'0'和0的小错误
- PAT 1001-1010 题解
- PAT 1011-1020 题解
- PAT 1021-1030 题解
- PAT 1031-1040 题解
- PAT 1041-1050 题解
- PAT 1051-1060 题解
- PAT(basic level)题解
- PAT乙级题解
- PAT题解目录
- PAT甲级题解目录
- android 中RectF构造函数参数说明
- 两个栈实现队列的功能。(外部接口是队列)
- algorithm count 函数
- POJ 3013 Big Christmas Tree(dijkstra 堆优化)
- 网络打印机安装教程:HP LaserJet Pro MFP M226dw,Windows解决外网无法使用打印机问题
- PAT a1038题解
- 斐波那契数列衍生之 求青蛙跳上n级台阶的 跳法数(递归)
- 【spring boot】异步请求
- Oracle索引原理
- jquery中attr()和prop()的区别
- log4j的出力等级
- centos7 安装MySQLdb模块出现 EnvironmentError: mysql_config not found
- 图书馆里有没有某本书,现有6人排队,有3个人来借此书,3个人来还此书,且若到某人借书时,若无书,则立即离开,多少种排队方法能借到书?
- grep搜索子目录中包含某字符串的特定文件