题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1234
#include<stdio.h>
#include<string.h>
struct point
{
char s1[20],s2[20],s3[20];//假设是定义成s1[15],s2[15],s3[15]就会出错
}p[100];//定义结构体数组
int main()
{
int N,M,i;
scanf("%d",&N);
while(N--)
{
scanf("%d",&M);
for(i=0;i<M;i++)
scanf("%s%s%s",p[i].s1,p[i].s2,p[i].s3);
int p1,p2;
p1=p2=0;
for(i=0;i<M;i++)
{
if(strcmp(p[i].s2,p[p1].s2)<0) p1=i;
if(strcmp(p[i].s3,p[p2].s3)>0) p2=i;
}
printf("%s %s\n",p[p1].s1,p[p2].s1);
}
return 0;
}
//结构体排序方法
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct ndoe{
char s1[20],s2[20],s3[20];
}p[100];
int cmp(const void *a,const void *b){
return strcmp(((ndoe *)a)->s2,((ndoe *)b)->s2);//字符串排序 按字典顺序
}
int cop(const void *a,const void *b){
return strcmp(((ndoe *)a)->s3,((ndoe *)b)->s3);
}
int main(){
int m,n,i;
scanf("%d",&m);
while(m--){
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s %s %s",p[i].s1,p[i].s2,p[i].s3);
qsort(p,n,sizeof(p[0]),cmp);
printf("%s ",p[0].s1);
qsort(p,n,sizeof(p[0]),cop);
printf("%s\n",p[n-1].s1);
}
return 0;
}

HDU oj 开门人与关门人的更多相关文章

  1. I题 hdu 1234 开门人和关门人

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1234 开门人和关门人 Time Limit: 2000/1000 MS (Java/Others)   ...

  2. HDU 1234:开门人和关门人

    开门人和关门人 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  3. hdoj 1234 开门人和关门人

    开门人和关门人 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) #include ...

  4. 【ACM】hdu_1234_开门人和关门人_201307300845

    开门人和关门人Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  5. [C#] 逆袭——自制日刷千题的AC自动机攻克HDU OJ

    前言 做过杭电.浙大或是北大等ACM题库的人一定对“刷题”不陌生,以杭电OJ为例:首先打开首页(http://acm.hdu.edu.cn/),然后登陆,接着找到“Online Exercise”下的 ...

  6. hdu oj 1285 确定比赛名次

    hdu oj 1285 确定比赛名次 题目: 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  7. Journal of Proteome Research | Global Proteomic Analysis of Lysine Succinylation in Zebrafish (Danio rerio) (解读人:关姣)

    文献名:Global Proteomic Analysis of Lysine Succinylation in Zebrafish (Danio rerio)(斑马鱼赖氨酸琥珀酰化的全球蛋白质组学分 ...

  8. sort(hdu oj 1425)计数排序和快速排序

    Description 给你n个整数,请按从大到小的顺序输出其中前m大的数. Input 每组测试数据有两行,第一行有两个数n,m(0 < n,m < 1000000),第二行包含n个各不 ...

  9. 杭电OJ(HDU)-ACMSteps-Chapter Three-《FatMouse&#39; Trade》《今年暑假不AC》《排名》《开门人和关门人》

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2Fpc2luaV92Yw==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

随机推荐

  1. 文件的软硬链接& 文件编辑vi和vim

    目录 文件的软硬链接 1.软链接 2.硬链接 文件编辑vi和vim 须先安装vim命令的软件包yum install -y vim 三种模式: 1.普通模式 2.编辑模式 3.末行模式 文件的软硬链接 ...

  2. Flask 系列之 构建 Swagger UI 风格的 WebAPI

    说明 操作系统:Windows 10 Python 版本:3.7x 虚拟环境管理器:virtualenv 代码编辑器:VS Code 实验 环境初始化 # 创建项目目录 mkdir helloworl ...

  3. appIcon

    原文地址:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconM ...

  4. url编码&&PHP大法&&这个看起来有点简单&&HTML 中有用的字符实体

    URL编码 Url编码通常也被称为百分号编码(Url Encoding,also known as percent-encoding),是因为它的编码方式非常简单,使用%百分号加上两位的字符——012 ...

  5. POJ:3461-Oulipo(KMP模板题)

    原题传送:http://poj.org/problem?id=3461 Oulipo Time Limit: 1000MS Memory Limit: 65536K Description The F ...

  6. Java-转换原始类型为一个字符串

    package com.tj; public class MyClass implements Cloneable { public static void main(String[] args) { ...

  7. 【04】在 PR 中关闭 issue

    [04]在 PR 中关闭 issue   似乎要给别人PR.     比如你在创建一个 pull request 去修复 issue #234.那你可在 PR 输入「fixes #234」,就可以自动 ...

  8. Wp 导航到手机定位设置页面

    WP开放了很多选择器和启动器,找了半天没发现有打开定位设置页面的,找了好久终于找到了解决办法: await Windows.System.Launcher.LaunchUriAsync(new Uri ...

  9. selenium之定位以及切换frame

    总有人看不明白,以防万一,先在开头大写加粗说明一下: frameset不用切,frame需层层切! 很多人在用selenium定位页面元素的时候会遇到定位不到的问题,明明元素就在那儿,用firebug ...

  10. 在LoadRunner向远程Linux/Unix执行命令行并收集性能数据

    前面介绍过在LoadRunner的Java协议实现“使用SSH连接Linux”,当然连接之后的故事由你主导. 今天要讲的,是一个非Java版本.是对“在LoadRunner中执行命令行程序之:pope ...