HDU--2115
I Love This Game
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6357 Accepted Submission(s): 2175
shortest time will be the winner . Now give you their names and the time of finishing the competition , your task is to give out the rank of them ; please output their name and the rank, if they have the same time , the rank of them will be the same ,but you
should output their names in lexicographic order.You may assume the names of the players are unique.
Is it a very simple problem for you? Please accept it in ten minutes.
integer value of zero.
Please output the rank of all players, the output format is shown as sample below;
Output a blank line between two cases.
10
Iverson 17:19
Bryant 07:03
Nash 09:33
Wade 07:03
Davies 11:13
Carter 14:28
Jordan 29:34
James 20:48
Parker 24:49
Kidd 26:46
0
Case #1
Bryant 1
Wade 1
Nash 3
Davies 4
Carter 5
Iverson 6
James 7
Parker 8
Kidd 9
Jordan 10
#include<stdio.h>
#include<string.h>
struct people{
char name[50];
int time;
int rank;
} a[11];
char temp[50];
int main()
{
int n,i,count=0,m,s,j;
while(scanf("%d",&n),n)
{
if(count) printf("\n");
count++;
printf("Case #%d\n",count);
for(i=1;i<=n;i++)
{
scanf("%s %d:%d",a[i].name,&m,&s);
a[i].time=m*60+s;
}
for(i=1;i<=n;i++)
for(j=i+1;j<=n;j++)
{
if(a[i].time>a[j].time)
{
strncpy(temp,a[j].name,50);
strncpy(a[j].name,a[i].name,50);
strncpy(a[i].name,temp,50);
m=a[i].time;
a[i].time=a[j].time;
a[j].time=m;
}
}
a[1].rank=1;
for(i=2;i<=n;i++)
if(a[i].time==a[i-1].time)
a[i].rank=a[i-1].rank;
else
a[i].rank=i;
for(i=1;i<=n;i++)
printf("%s %d\n",a[i].name,a[i].rank);
}
return 0;
}
HDU--2115的更多相关文章
- HDU 2115 I Love This Game
http://acm.hdu.edu.cn/showproblem.php?pid=2115 Problem Description Do you like playing basketball ? ...
- 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 ...
随机推荐
- 【Zookeeper】源码分析之服务器(三)之LeaderZooKeeperServer
一.前言 前面分析了ZooKeeperServer源码,由于QuorumZooKeeperServer的源码相对简单,于是直接分析LeaderZooKeeperServer. 二.LeaderZooK ...
- 506. Relative Ranks
Given scores of N athletes, find their relative ranks and the people with the top three highest scor ...
- bzoj 1179: [Apio2009]Atm
Description Input 第 一行包含两个整数N.M.N表示路口的个数,M表示道路条数.接下来M行,每行两个整数,这两个整数都在1到N之间,第i+1行的两个整数表示第i条道路 的起点和终点的 ...
- git正确的删除远程仓库的文件并用.gitignore忽略提交此文件
我向远程仓库提交了如下文件src/ pom.xml target/ WebContent/,发现没必要提交target目录. 于是做了如下操作: git rm -r --cached target g ...
- touchstart和touchend事件
touchstart和touchend事件 移动互联网是未来的发展趋势,现在国内很多互联网大佬都在争取移动这一块大饼,如微信及支付宝是目前比较成功的例子,当然还有各种APP和web运用. 由于公司的需 ...
- Linux(CentOS6.5)修改默认yum源为国内的阿里云、网易yum源
官方的yum源在国内访问效果不佳. 需要改为国内比较好的阿里云或者网易的yum源 修改方式: echo 备份当前的yum源 mv /etc/yum.repos.d /etc/yum.repos.d.b ...
- 在一个终端后台运行的进程在新的终端中使用job不会被发现
我在一个终端后台运行了一个程序.之后由于工作需要又新开了一个新的终端.在新的终端中,我想查看后台程序的运行状态,输入jobs时,发现没有后台任务运行.难道我的程序死掉了?我接着top了下,发现我的后台 ...
- Java版本APP接口安全设计
Java版本APP接口安全设计 安全设计分为两种: 1.传输安全. 2. 会话安全. 1.传输安全 怎么保证接口经过网络传输不被抓包获取? 1.如果只是使用对称性算法,破解APP拿到加密密钥就可以解密 ...
- docker 保存 加载(导入 导出镜像
tensorflow 的docker镜像很大,pull一次由于墙经常失败.其实docker 可以将镜像导出再导入. 保存加载(tensorflow)镜像 1) 查看镜像 docker images 如 ...
- 使用svn 的解决 处理svn状态冲突
当直接只用版本浏览器进行svn的删除操作是,在客户端svn目录里,出现svn版本错误信息提示,使用 svn 解决命令,处理冲突保存 svn resolve --accept=working PATH( ...