I Love This Game 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.
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
Bryant 1
Wade 1
Nash 3
Davies 4
Carter 5
Iverson 6
James 7
Parker 8
Kidd 9
Jordan 10
#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(结构体)的更多相关文章
- Go结构体实现类似成员函数机制
Go语言结构体成员能否是函数,从而实现类似类的成员函数的机制呢?答案是肯定的. package main import "fmt" type stru struct { testf ...
- C#基础回顾(二)—页面值传递、重载与重写、类与结构体、装箱与拆箱
一.前言 -孤独的路上有梦想作伴,乘风破浪- 二.页面值传递 (1)C#各页面之间可以进行数据的交换和传递,页面之间可根据获取的数据,进行各自的操作(跳转.计算等操作).为了实现多种方式的数据传递,C ...
- go语言结构体
定义: 是一种聚合的数据类型,是由零个或多个任意类型的值聚合成的实体. 成员: 每个值称为结构体的成员. 示例: 用结构体的经典案例处理公司的员工信息,每个员工信息包含一个唯一的员工编号.员工的名字. ...
- C语言中的结构体
用户自己建立自己的结构体类型 1. 定义和使用结构体变量 (1).结构体的定义 C语言允许用户自己建立由不同类型数据组成的组合型的数据结构,它称为结构体. (2).声明一个结构体类型的一般形式为: ...
- C++_系列自学课程_第_12_课_结构体
#include <iostream> #include <string> using namespace std; struct CDAccount { double bal ...
- java socket传送一个结构体给用C++编写的服务器解析的问题
另一端是Java写客户端程序,两者之间需要通信.c++/c接收和发送的都是结构体,而Java是直接发送的字节流或者byte 数组.解决方法:c++/c socket 在发送结构体的时候其实发送的也是字 ...
- swift学习笔记3——类、结构体、枚举
之前学习swift时的个人笔记,根据github:the-swift-programming-language-in-chinese学习.总结,将重要的内容提取,加以理解后整理为学习笔记,方便以后查询 ...
- HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- C语言结构体对齐
1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...
- C与指针(结构体指针,函数指针,数组指针,指针数组)定义与使用
类型 普通指针 指针数组(非指针类型) 数组指针 结构体指针 函数指针 二重指针 定义方式 int *p; int *p[5]; int (*p)[5]; int a[3][5]; struct{.. ...
随机推荐
- hdu3844 Mining Your Own Business,无向双连接组件
点击打开链接 无向图的双连通分量 #include<cstdio> #include<stack> #include<vector> #include<map ...
- Redis源代码分析(23)--- CRC循环冗余算法RAND随机数的算法
他今天就开始学习Redis源代码的一些工具来实现,在任何一种语言工具.算法实现的原理应该是相同的,一些比較经典的算法.比方说我今天看的Crc循环冗余校验算法和rand随机数产生算法. CRC算法全称循 ...
- zend studio 安装emmet(zen coding)
help->Install New Software 在work with后面点击Add,弹出的对话框中填写信息: Name:随意 Location:http://emmet.io/eclips ...
- RunJS推荐用于个人使用(使用方便JS、css实时预览、编辑、管理等功能)
RunJS,在线编写.展示html.js.css代码,拥有实时预览.分享.Fork.代码高亮.自己主动完毕等多项特性,提供文件上传.多种登录方式. 地址:http://runjs.cn/ waterm ...
- Windows 8 键盘上推自定义处理
原文:Windows 8 键盘上推自定义处理 在Windows 8 应用程序中,当TextBox控件获得焦点时,输入面板会弹出,如果TextBox控件处于页面下半部分,则系统会将页面上推是的TextB ...
- SQLSERVER中的log block校验(译)
原文:SQLSERVER中的log block校验(译) SQLSERVER中的log block校验(译) 来自:http://sankarreddy.com/2010/03/transaction ...
- RH033读书笔记(16)-Lab 17 Installation and Administration Tools
Lab 17 Installation and Administration Tools Goal: Become familiar with system configuration tools a ...
- C random C ++rand函数应用
random函数不是ANSI C标准,不能在gcc,vc等编译器下编译通过.但在C语言中int random(num)能够这样使用,它返回的是0至num-1的一个随机数. 可改用C++下的rand函数 ...
- 【Flume】flume于transactionCapacity和batchSize进行详细的分析和质疑的概念
我不知道你用flume读者熟悉无论这两个概念 一开始我是有点困惑,? 没感觉到transactionCapacity的作用啊? batchSize又是干啥的啊? -- -- 带着这些问题,我们深入源代 ...
- POJ1458 Common Subsequence 【最长公共子序列】
Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 37614 Accepted: 15 ...