计蒜客 第 m 大的身份证号码 (水)
2024-10-21 16:06:17
链接 : Here!
**思路 : ** 水题
**代码 : **
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
struct info {
int ages;
string id;
};
int n, m;
bool cmp(info a, info b) {
if (a.ages == b.ages) {
return a.id < b.id;
}
return a.ages < b.ages;
}
int main() {
while (scanf("%d%d", &n, &m) != EOF) {
info data[110];
for (int i = 0 ; i < n ; ++i) {
cin >> data[i].id;
int temp = 0;
for (int j = 6 ; j <= 13 ; ++j) {
temp = temp * 10 + data[i].id[j];
}
data[i].ages = temp;
}
sort(data, data + n, cmp);
cout << data[m - 1].id << endl;
}
return 0;
}
最新文章
- [转]彻底征服Word 2007标题多级列表
- SD卡驱动分析(二)
- Maven仓库详解
- BeanUtils属性
- Jquery页面跳转
- css画三角形,梯形
- android 与 服务器通信
- 性能超前,详解腾讯云新一代Redis缓存数据库
- 【代码笔记】Web-Javascript-javascript break和continue语句
- LeetCode算法题-Number of Segments in a String(Java实现)
- easy install 与pip
- java之代码复用
- ORA-00847: MEMORY_TARGET/MEMORY_MAX_TARGET and LOCK_SGA cannot be set together
- Linux安装rz/sz,htop插件
- 排序NB三人组
- 20165302 程上杰 Exp2 后门原理与实践
- jQuery table td可编辑
- Git Flow 代码版本控制模型
- MySQL学习【第二篇安装】
- &#39;qt_sql_default_connection&#39; is still in use
热门文章
- poj 1734 floyd求最小环,可得到环上的每个点
- 通过PYTHON操作JIRA的COMMENT注释和TRANSITION工作流
- Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
- Maven错误:[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?的解决方法
- 一次获取多个oracle序列值
- HDOJ1796 How many integers can you find(dfs+容斥)
- Tool-杂项-建模:犀牛(3D造型软件)
- c# 获取本周开始时间与结束时间
- java+appium+安卓模拟器实现app自动化Demo
- git 本地项目推送至远程仓库