HDU 2115 I Love This Game(结构体排序 or pair)

网友投稿 871 2022-08-23

HDU 2115 I Love This Game(结构体排序 or pair)

HDU 2115 I Love This Game(结构体排序 or pair)

I Love This Game

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7163    Accepted Submission(s): 2451

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

​​HDU 2007-10 Programming Contest_WarmUp ​​

题解:结构体 or paire[12].

AC代码:

#include#include#include#include#include#include#include#include#include#include#include#include#include#includetypedef long long LL;using namespace std;//数学公式:1^3+2^3+3^3+....n^3=[n(n+1)/2]^2 struct node{ char name[10]; int m,s;}p[11];bool cmp(node a,node b){ if(a.m==b.m&&a.s==b.s) return strcmp(a.name,b.name)<0; //按字典序从小到大 else if(a.m==b.m) return a.s

AC:pair

#include #include #include #include #include using namespace std;//#define LOCALint main(){#ifdef LOCAL freopen("in.txt","r",stdin);#endif int T=0,n,mc[12]; string str1,str2; pair e[12]; while(cin>>n,n) { if(T) cout<1) cout<>str1>>str2; e[i]=make_pair(str2,str1); } sort(e,e+n); mc[0]=1; for(int i=1;i

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:HDU 2006 求奇数的乘积(水题)
下一篇:软件架构到底是要解决什么问题?(软件架构的目标,不正确的是)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~