sdut--Find a girl friend(结构体的二级排序)
来源:互联网 发布:java.net.encode 编辑:程序博客网 时间:2024/05/16 00:29
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 <algorithm>#include <cstdio>#include <string>using namespace std;struct node{ int h; string n;}q[10000];bool cmp(node a,node b){ return a.h<b.h;}int main(){ int n; 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
- 优先队列结构体重载的二级排序
- 省赛第一个氺题--结构体二级排序
- 开始博客之旅
- 用QML创建 QQuickWindow
- HTML适应手机浏览器宽度
- slow query log
- 程序员开发中所碰到的一下困难
- sdut--Find a girl friend(结构体的二级排序)
- KETTLE如何实现实时的增量更新(两种方法)
- 神奇的mongo:索引
- c#中decimal ,double,float的区别
- 各种报错所谓何事?!
- eigen:C++矩阵处理工具
- 树和二叉树
- springmvc下载文件
- Android Selector全解