hdu 5427 A problem of sorting(水)
2015-10-11 21:16
435 查看
题目链接:hdu 5427 A problem of sorting
代码
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; const int maxn = 205; typedef pair<int,int> pii; int N; pii G[maxn]; char name[maxn][maxn]; int main () { int cas; scanf("%d", &cas); while (cas--) { scanf("%d%*c", &N); for (int i = 0; i < N; i++) { gets(name[i]); int n = strlen(name[i]); int& u = G[i].first; u = 0; for (int j = 4; j; j--) { u = u * 10 + name[i][n-j] - '0'; } G[i].second = i; name[i][n-5] = '\0'; } sort(G, G + N); for (int i = N-1; i >= 0; i--) printf("%s\n", name[G[i].second]); } return 0; }
相关文章推荐
- 贺利坚练习(4)
- 【华为】MUX VLAN配置详解
- HDU2642 Stars 二维树状数组
- 3-单一职责原则+4-开放封闭原则+5依赖倒转原则
- virtualbox安装提示出现严重错误解决办法
- COGS132珍珠分对|优先队列
- c语言学习笔记(12)条件编译使用分析
- 使用字符串处理函数
- spy++的使用
- 【日常学习】【欧拉功能】codevs2296 荣誉的解决方案卫队的一个问题
- 九九乘法表
- struts2学生信息管理系统篇章④
- jquery简单动画效果(上)
- Win7平台VS2010安装Visual Assist X
- Win7平台VS2010安装Visual Assist X
- Win7平台VS2010安装Visual Assist X
- 测试二知识总结
- php UNSIGNED ZEROFILL
- CSS设置DIV居中
- NFS实例 rhel 7