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, &P[I].H1, &P[i].m1, the&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