sdut Find a girl friend(结构体的二级排序)
来源:互联网 发布:c高性能编程 pdf 编辑:程序博客网 时间:2024/04/29 02:04
Find a girl friend
Time Limit: 1000ms Memory limit: 262144K 有疑问?点这里^_^
题目描述
CC wants to find a girl friend, he knows each girl's age and name in his class, and each girl’s age is different..
Now he wants to know the youngest girl's name and the eldest girl’s name, can you help him?
输入
Input will consist of T test cases (1≤T≤10).
The first line of each test case contains a single integer n -- the number of girls (1≤n≤50).
Each of the following n lines contains Ai, Si, the ith girl's age and name (3≤age≤80, 2≤length(name)≤20), separated by exactly one space.
Each girl’s name consists of between 2 and 20 lowercase letters.
输出
For each test case, output the youngest girl's name and the eldest girl's name, seperated by exactly one space.
示例输入
521 liyuchun18 fanbingbing19 zhangziyi22 liuyifei20 liuyan115 yangmi
示例输出
fanbingbing liuyifeiyangmi yangmi
这个题目主要是找到身高的最大值和最小值输出姓名,分别用空格隔开,代码如下:
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;struct node{ int h; char n[100];}q[10000];bool cmp(node a,node b){ return a.h < b.h;}int main(){ int n; int i,j; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) { cin>>q[i].h>>q[i].n; } sort(q,q + n,cmp); cout<<q[0].n<<" "<<q[n-1].n<<endl; } return 0;}
0 0
- sdut Find a girl friend(结构体的二级排序)
- sdut--Find a girl friend(结构体的二级排序)
- Find a girl friend
- 简单的结构体二级排序
- nyoj8(一种排序)(结构体的二级排序)
- 南阳 540 奇怪的排序(结构体二级排序)
- 结构体二级排序 qsort
- 结构体二级排序-改进
- qsort 结构体二级排序
- EXCEL排序(结构体二级排序)
- sort和qsort函数对结构体的二级排序
- sort函数对于结构体的二级排序
- sort函数结构体二级排序
- 结构体简单排序-一级-二级
- 大整数排序(结构体二级排序)
- a girl
- 优先队列结构体重载的二级排序
- 省赛第一个氺题--结构体二级排序
- C# 6.0 的那些事
- GStreamer Bus的一个细节
- .net datatable 查找一行时的方法比较datatable.rows.find vs datable.select vs dataview vs for loop
- C/C++字符串查找函数
- C#中ListBox控件设置Item字体并居中显示
- sdut Find a girl friend(结构体的二级排序)
- 内存分配——静态存储区 栈 堆
- Web前端应用常用技术大盘点
- 采用反射获取包名
- 業務システムの開発ドキュメント標準化 第2回:機能一覧表とI/O関連図
- 几种常见的排序算法(java实现)
- CSS技巧和经验列表
- 升级android sdk到5.0时,创建项目出现错误:No resource found that matches the given name 'android:Widget.Material.A
- List集合中的对象根据属性排序