Find a girl friend
2015-11-23 18:54
211 查看
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.示例输入
5 21 liyuchun 18 fanbingbing 19 zhangziyi 22 liuyifei 20 liuyan 1 15 yangmi
示例输出
fanbingbing liuyifei yangmi yangmi
提示
来源
青岛理工交流赛示例程序
#include<stdio.h> struct set { int age; char name[30]; }a[10],b,c; int main() { int i,j,n,m; while(scanf("%d",&n)!=EOF) { for(i=0;i<n;i++) { scanf("%d %s",&a[i].age,a[i].name); if(i==0) { b=a[i]; c=a[i]; } else { if(a[i].age>c.age) c=a[i]; if(a[i].age<b.age) b=a[i]; } } printf("%s %s\n",b.name,c.name); } }
相关文章推荐
- 素数间隙
- 远程服务器,后台运行?
- Bootstrap历练实例:表单控件大小
- 正则表达式的威力1_匹配matches()与切割split()
- MFC的序列化技术(一)
- nginx-push-stream-module安装
- Objective-C:神在细节之中
- sublime text笔记
- 实现伸缩的imageview
- 人活着系列之你的背包
- java的标准输入输出(二)
- Jquery插件 easyUI属性汇总
- 基于nutz框架理解Ioc容器
- ansible 自动化安装配置LAMP环境
- java中有垃圾回收GC, 为什么还要调用close
- CCF推荐国际学术会议
- 人活着系列之崔神爱过七夕
- ASP.NET配置KindEditor文本编辑器
- 6.3 南丁格尔玫瑰图
- 学习笔记16-OCFoundation框架(二)