HDU 1234 Simple Simulation questions

Source: Internet
Author: User

The topic is very simple not much to say, I just think that the input method of the topic is still very characteristic

1#include <cstdio>2#include <cstring>3#include <algorithm>4#include <iostream>5 using namespacestd;6 7 structpeople{8     Charname[ -];9     intH1, H2, M1, M2, s1, S2;Ten}p[10005]; One  A BOOLCMP1 (ConstPeople &p1,ConstPeople &p2) { -     if(p1.h1 = = P2.h1 && p2.m1 = = p1.m1)returnP1.s1 <p2.s1; -     Else if(p1.h1 = = p2.h1)returnP1.M1 <p2.m1; the     Else returnP1.h1 <p2.h1; - } -  - BOOLCMP2 (ConstPeople &p1,ConstPeople &p2) { +     if(P1.h2 = = P2.h2 && p2.m2 = = p1.m2)returnP1.s2 >p2.s2; -     Else if(P1.H2 = = P2.H2)returnp1.m2 >p2.m2; +     Else returnP1.h2 >p2.h2; A } at  - intMain () - { -   //freopen ("a.in", "R", stdin); -     intT, N; -scanf"%d", &T); in      while(t--){ -scanf"%d", &n); toMemset (P,0,sizeof(P)); +          for(inti =1; I<=n; i++){ -scanf"%s%d:%d:%d%d:%d:%d", P[i].name, &AMP;P[I].H1, &P[i].m1, the&AMP;P[I].S1, &p[i].h2, &p[i].m2, &p[i].s2); *            //cout<<p[i].h1<< ":" <<p[i].m1<< ":" <<p[i].s1<<endl; $         }Panax NotoginsengSort (p+1, p+n+1, CMP1); -printf"%s", p[1].name); theSort (p+1, p+n+1, CMP2); +printf"%s\n", p[1].name); A     } the     return 0; +}

HDU 1234 Simple Simulation questions

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.