The problem is simple , Find the front , Find the last , The idea is very clear ：

code ：
#include <cstdio> #include <cstring> #include <vector> #include <queue>
#include <iostream> #include <algorithm> #define int long long using namespace
std; const int N = 1010; struct node{ char name[20]; char betime[20]; char
endtime[20]; }person[N]; int n; bool cmp1(struct node a,struct node b){ return
strcmp(a.betime, b.betime)<0?true:false; } bool cmp2(struct node a,struct node
b){ return strcmp(a.endtime, b.endtime)>0?true:false; } signed main() { cin>>n;
for(int i=1;i<=n;i++) {
cin>>person[i].name>>person[i].betime>>person[i].endtime; }
sort(person+1,person+1+n,cmp1); printf("%s",person[1].name); printf(" ");
sort(person+1,person+1+n,cmp2); printf("%s",person[1].name); printf("\n");
return 0; }
However, the goose needs to pay attention to ：
// Find the writing method of a string from small to large bool cmp1(struct node a,struct node b){ return
strcmp(a.betime, b.betime)<0?true:false; }

Technology
Daily Recommendation
views 1