HDU 2115 I Love This Game
http://acm.hdu.edu.cn/showproblem.php?pid=2115
Is it a very simple problem for you? Please accept it in ten minutes.
Please output the rank of all players, the output format is shown as sample below;
Output a blank line between two cases.
0
时间复杂度:$O(N * logN)$
代码:
#include <bits/stdc++.h>
using namespace std; int N; struct Player {
char name[300];
int hh;
int mm;
int Time;
}player[150]; bool cmpTime( Player& a, Player& b) {
if(a.Time == b.Time)
return strcmp(a.name, b.name) < 0;
return a.Time < b.Time;
} int main() {
int casee = 1;
while(~scanf("%d", &N)) { if(!N) break;
if(casee!=1)
printf("\n");
printf("Case #%d\n", casee ++); for(int i = 1; i <= N; i ++) {
scanf("%s %d:%d", player[i].name, &player[i].hh, &player[i].mm);
player[i].Time = player[i].hh * 60 + player[i].mm;
} sort(player + 1, player + 1 + N, cmpTime); int num = 1; for(int i = 1; i <= N; i ++) {
printf("%s ", player[i].name);
if(player[i].Time == player[i - 1].Time)
printf("%d\n", num);
else {
num = i;
printf("%d\n", num);
}
}
}
return 0;
}
HDU 2115 I Love This Game的更多相关文章
- HDOJ(HDU) 2115 I Love This Game(排序排序、、、)
Problem Description Do you like playing basketball ? If you are , you may know the NBA Skills Challe ...
- -【线性基】【BZOJ 2460】【BZOJ 2115】【HDU 3949】
[把三道我做过的线性基题目放在一起总结一下,代码都挺简单,主要就是贪心思想和异或的高斯消元] [然后把网上的讲解归纳一下] 1.线性基: 若干数的线性基是一组数a1,a2,a3...an,其中ax的最 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- hdu 2117:Just a Numble(水题,模拟除法运算)
Just a Numble Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- HDU——2119 Matrix
Matrix Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
随机推荐
- php7+apache2.4+mysql 环境配置(window环境)
最近,小主从事PHP开发.特将最近如何搭建php7的过程记录在此!希望有需要,可以借鉴!( 电脑必须win7 sp1以上, .netframework4 ) Windows7安装php7,Win7+p ...
- 修改注册表删除Windows资源管理器 “通过QQ发送” 右键菜单项
运行regedit 展开至:HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers 删除QQShellExt项
- MVC PartialView 方式实现点击加载更多
<table id="MovieListing"> </table><div> <button id="btnShowMore& ...
- clr via c#读书笔记五:常量和字段
1.常量是值从不变化的符号.只能定义编译器识别的基元类型的常量.如:Boolean,Char,Byte,SByte,Int16,UInt16,Int32,UInt32,Int64,Single,Dou ...
- xencenter迁移云主机方法
问题:POOL中计算节点内存不足. 解决方法:1.为计算节点添加内存(费用高)2.将部分资源迁移到其它POOL中. 方法: 1.选择要迁移的虚拟机 2.选择保存路径 这里可以看到可以批量导出: 注意: ...
- vuecli结合eslint静态检查
vuecli结合eslint静态检查 搭建vue项目开发可能选择vue-cli项目脚手架快速创建vue项目.(https://github.com/vuejs/vue-cli) 安装vue-cli n ...
- 【二】H.264/MPEG-4 Part 10 White Paper 翻译之 Prediction of Intra Macroblocks
翻译版权所有,转载请注明出处~ xzrch@2018.09.14 ------------------------------------------------------------------- ...
- lesson 24 A skeleton in the cupboard
lesson 24 A skeleton in the cupboard conceal sth from sb 对某人隐藏某事 He conceals his girlfriend from his ...
- Dos命令以及相关文件的访问
1.转到相关目录 有时候想从当前目录转到D盘,用此目录cd d:是没有用的, 最好用cd /d d:是可以的 2.查看目录文件 dir 3.往服务器上传文件文件 通过文件浏览器上传文件,只适用于Win ...
- go通过第三方库 mahonia gbk 转utf8
go get github.com/axgle/mahonia dec := mahonia.NewDecoder("GBK")ret:=dec.ConvertString(res ...