注意前导零的消去。

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std; string s[+];
int n; bool cmp(const string &a, const string &b)
{
return a+b<b+a;
} int main()
{
cin>>n;
for(int i=;i<=n;i++) cin>>s[i];
sort(s+,s++n,cmp);
string ans;
for(int i=;i<=n;i++) ans=ans+s[i]; int flag=; for(int i=;i<ans.size();i++)
{
if(ans[i]!='')
{
flag = ;
for(int j=i;j<ans.size();j++) cout<<ans[j];
break;
}
} if(flag==) cout<<"";
cout<<endl;
return ;
}

PAT (Advanced Level) 1038. Recover the Smallest Number (30)的更多相关文章

  1. 【PAT甲级】1038 Recover the Smallest Number (30 分)

    题意: 输入一个正整数N(<=10000),接下来输入N个字符串,每个字符串包括至多8个字符,均为数字0~9.输出由这些字符串连接而成的最小数字(不输出前导零). trick: 数据点0只包含没 ...

  2. pat 甲级 1038. Recover the Smallest Number (30)

    1038. Recover the Smallest Number (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHE ...

  3. PAT 甲级 1038 Recover the Smallest Number (30 分)(思维题,贪心)

    1038 Recover the Smallest Number (30 分)   Given a collection of number segments, you are supposed to ...

  4. 1038. Recover the Smallest Number (30)

    题目链接:http://www.patest.cn/contests/pat-a-practise/1038 题目: 1038. Recover the Smallest Number (30) 时间 ...

  5. PAT Advanced 1038 Recover the Smallest Number (30) [贪⼼算法]

    题目 Given a collection of number segments, you are supposed to recover the smallest number from them. ...

  6. PAT 1038 Recover the Smallest Number (30分) string巧排序

    题目 Given a collection of number segments, you are supposed to recover the smallest number from them. ...

  7. 1038. Recover the Smallest Number (30) - 字符串排序

    题目例如以下: Given a collection of number segments, you are supposed to recover the smallest number from ...

  8. 1038 Recover the Smallest Number (30)(30 分)

    Given a collection of number segments, you are supposed to recover the smallest number from them. Fo ...

  9. 1038 Recover the Smallest Number (30分)(贪心)

    Given a collection of number segments, you are supposed to recover the smallest number from them. Fo ...

随机推荐

  1. php中的define()函数

    <?php define("PI",3.1415926); //定义常量 $r=12;//定义圆半径 echo "半径为12的单位的圆的面积".PI*($ ...

  2. dataTables去掉搜索框和每页多少条框体,解决Cannot reinitialise DataTable问题

    $('#example').DataTable({ searching:false, //去掉搜索框 bLengthChange:false,//去掉每页多少条框体 "language&qu ...

  3. phpstorm设置代码块快捷方式

    File -> Settings -> Live Templates

  4. react基础语法(二)常用语法如:样式 ,自定义属性,常用表达式

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. SAP CRM和Cloud for Customer中的Event handler(事件处理器)

    SAP CRM可以在开发工具中用右键直接创建一个新的事件处理器: 这些事件处理器实际上就是UI控制器(Controller)上具有特定接口类型的方法. C4C UI的event handler 在C4 ...

  6. environ - 用户环境(变量)

    SYNOPSIS 总览 extern char **environ; DESCRIPTION 描述 变量 environ 指向的是一个叫 'environment'(环境)的字符串数组 (这个变量必须 ...

  7. vscode setting.json

    setting.json { "sync.gist": "#github的码##", "sync.lastUpload": "20 ...

  8. SQA定义、质量模型、SQA与测试的关系

  9. Caused by: java.lang.IllegalArgumentException: Parameter Maps collection does not contain value for com.bj186.crm.mapper.UserMapper.Integer

    在使用SSM整合myBatis的过程中遇到了这个问题. 问题的原因: 把parameterType错误的写成了parameterMap 解决办法: 将parameterMap修改为parameterT ...

  10. 第4节 hive调优:2、数据倾斜

    数据的倾斜: 主要就是合理的控制我们的map个数以及reduce个数 第一个问题:maptask的个数怎么定的???与我们文件的block块相关,默认一个block块就是对应一个maptask 第二个 ...