HDU OJ Door man and closing man

Source: Internet
Author: User




#include <stdlib.h>
#include <stdio.h>
struct node{
Char s[15];
int hour1;
int fen1;
int mia1;
int hour2;
int fen2;
int mia2;
}C[100];
int cmp (const void *a,const void *b)//QSOTRTSortThree-level structure sorting
{
struct node *c= (node *) A;
struct node *d= (node *) b;
if (C-&GT;HOUR1!=D-&GT;HOUR1) return c->hour1-d->hour1;
else if (C-&GT;FEN1!=D-&GT;FEN1)
Return c->fen1-d->fen1;
else return c->mia1-d->mia1;
}
int cop (const void *a,const void *b)//qsortSortThree-level structure sorting
{
struct node *c= (node *) A;
struct node *d= (node *) b;
if (C-&GT;HOUR2!=D-&GT;HOUR2) return d->hour2-c->hour2;
else if (C-&GT;FEN2!=D-&GT;FEN2)
Return d->fen2-c->fen2;
else return d->mia2-c->mia2;
}
Main ()
{
int n;
scanf ("%d", &n);
while (n--)
{
int m;
scanf ("%d", &m);
Char s1[15],s2[15];
for (int i=0;i
{
scanf ("%s%d:%d:%d%d:%d:%d", C[i].s,&c[i].hour1,&c[i].fen1,&c[i].mia1,&c[i].hour2,&c[i].fen2 , &AMP;C[I].MIA2);
}
Qsort (C,m,sizeof (c[0]), CMP);
printf ("%s", C[0].S);
Qsort (C,m,sizeof (c[0]), COP);
printf ("%s\n", C[0].S);
}
}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

HDU OJ Door man and closing man

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.