Problem Description
Do you like playing basketball ? If you are , you may know the NBA Skills Challenge . It is the content of the basketball skills . It include several parts , such as passing , shooting , and so on. After completion of the content , the player who takes the 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.

 
Input
This problem contains multiple test cases! Ease test case contain a n(1<=n<=10) shows the number of players,then n lines will be given. Each line will contain the name of player and the time(mm:ss) of their finish.The end of the input will be indicated by an integer value of zero.
 
Output
The output format is shown as sample below.
Please output the rank of all players, the output format is shown as sample below;
Output a blank line between two cases.
 
Sample Input
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
 
Sample Output
Case #1
Bryant 1
Wade 1
Nash 3
Davies 4
Carter 5
Iverson 6
James 7
Parker 8
Kidd 9
Jordan 10
 
Author
為傑沉倫
 
Source
 
 
 #include <stdio.h>
#include <math.h>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <string>
#include <string.h>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
struct db
{
char n[];
char t[];
};
bool cmp(db a,db b){
if(a.t!=b.t)
return strcmp(a.t,b.t)<;
else
return strcmp(a.n,b.n)<;
}
db s[];
int main()
{
int n,i,j;
int c=;
int t=;
while(scanf("%d",&n)&&n)
{
if(t>)
printf("\n");
for(i=;i<=n;i++)
scanf("%s%s",s[i].n,s[i].t);
sort(s+,s+n+,cmp);
printf("Case #%d\n",++c);
for(i=;i<=n;i++)
{
printf("%s %d\n",s[i].n,i);
if(strcmp(s[i].t,s[i+].t)==)
{
printf("%s %d\n",s[i+].n,i);
i++;
}
}
t++;
}
return ;
}

I Love This Game 2115(结构体)的更多相关文章

  1. Go结构体实现类似成员函数机制

    Go语言结构体成员能否是函数,从而实现类似类的成员函数的机制呢?答案是肯定的. package main import "fmt" type stru struct { testf ...

  2. C#基础回顾(二)—页面值传递、重载与重写、类与结构体、装箱与拆箱

    一.前言 -孤独的路上有梦想作伴,乘风破浪- 二.页面值传递 (1)C#各页面之间可以进行数据的交换和传递,页面之间可根据获取的数据,进行各自的操作(跳转.计算等操作).为了实现多种方式的数据传递,C ...

  3. go语言结构体

    定义: 是一种聚合的数据类型,是由零个或多个任意类型的值聚合成的实体. 成员: 每个值称为结构体的成员. 示例: 用结构体的经典案例处理公司的员工信息,每个员工信息包含一个唯一的员工编号.员工的名字. ...

  4. C语言中的结构体

    用户自己建立自己的结构体类型 1.  定义和使用结构体变量 (1).结构体的定义 C语言允许用户自己建立由不同类型数据组成的组合型的数据结构,它称为结构体. (2).声明一个结构体类型的一般形式为: ...

  5. C++_系列自学课程_第_12_课_结构体

    #include <iostream> #include <string> using namespace std; struct CDAccount { double bal ...

  6. java socket传送一个结构体给用C++编写的服务器解析的问题

    另一端是Java写客户端程序,两者之间需要通信.c++/c接收和发送的都是结构体,而Java是直接发送的字节流或者byte 数组.解决方法:c++/c socket 在发送结构体的时候其实发送的也是字 ...

  7. swift学习笔记3——类、结构体、枚举

    之前学习swift时的个人笔记,根据github:the-swift-programming-language-in-chinese学习.总结,将重要的内容提取,加以理解后整理为学习笔记,方便以后查询 ...

  8. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. C语言结构体对齐

    1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...

  10. C与指针(结构体指针,函数指针,数组指针,指针数组)定义与使用

    类型 普通指针 指针数组(非指针类型) 数组指针 结构体指针 函数指针 二重指针 定义方式 int *p; int *p[5]; int (*p)[5]; int a[3][5]; struct{.. ...

随机推荐

  1. 阿里游戏大数据sesson2_RF&amp;GBRT(上)

    ----------一个小的游戏体验,对于不太熟悉Xlab RF和GBRT同学们都叫参考,不喜勿喷,大神绕道,米姆达. . .. .---------- 6月初的时候LR 做到4.9后一直上不去,看群 ...

  2. web项目启动,运行方法

    1.显示器(Listener) web文件加入 <listener>      <listener-class>cn.ro.common.InitListener</li ...

  3. DataTable填补了实体类返回泛型集合

    坤哥见我昨天找了一段代码,如下面: 略微解释下,这段代码时D层查询结束后,将datatable查询到的结果赋值给实体对象的属性,然后返回实体的过程.坤哥看了之后问我,假设实体有500多个属性,难道也要 ...

  4. webstorm创建nodejs + express + jade 的web 项目

    webstorm创建nodejs + express + jade 的web 项目 前简单了解过nodejs,觉得用nodejs来做个网站也太麻烦了,要自己拼html的字符串返回,这能做网站嘛? 最近 ...

  5. HTML5 CSS3 精美案例 : 达到VCD盒个性幻灯片

    转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/31015121 哈,首先感谢下w3cfuns教师,行~ 行.这一次分享发夹CSS3 ...

  6. HTTP响应代码

    HTTP响应代码 1xx - 消息通知 这些状态代码表示临时响应.client在收到常规响应.应准备接收一个或多个 1xx 应. · 100 - Continue 初始的请求已经接受,客户应当继续发送 ...

  7. JDBC在getConnection之前为什么要调用Class.forName(转)

    获取一个数据库连接的通用模板如下: String driver = "oracle.jdbc.OracleDriver"; String url = "jdbc:orac ...

  8. 2014ACM上海邀请赛A解释称号

    #include <cstdio> #include <cstring> #include <iostream> using namespace std; cons ...

  9. PHP与EXCEL PHPExcel

    1.PHPExcel一个简短的引论 PHPExcel 它是用来操作Office Excel 文档PHP图书馆,它是基于微软的OpenXML标准PHP语言.能够使用它来读.写不同格电子表的类型格,例如 ...

  10. ssl通关的概念(一个)

    在公司最近的项目涉及多种加密.安全.我一直在这方面缺乏经验.很协议仅仅知道是什么概念.用于传输的加密SSL,也煞费苦心.非常easy一件事,折腾了很长一段时间.IT该行啊,真的是.难者不会,与会者困难 ...