标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12296 Accepted Submission(s): 6222
1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 using namespace std ; 5 struct people 6 { 7 char num[100] ; 8 char begin[30] ; 9 char end[30] ; 10 } ; 11 people t[1001] ; 12 13 bool cmp(people begin , people end) 14 { 15 return strcmp(begin.begin ,end.begin) < 0 ; 16 } 17 18 bool compare(people begin, people end) 19 { 20 return strcmp(begin.end, end.end) > 0 ; 21 } 22 int main() 23 { 24 int i, m, n ; 25 while(~scanf("%d",&m)) 26 { 27 while(m--) 28 { 29 scanf("%d", &n) ; 30 for(i=0; i<n; i++) 31 scanf("%s %s %s", t[i].num, t[i].begin, t[i].end) ; 32 sort(t, t+n, cmp) ; 33 printf("%s",t[0].num) ; 34 sort(t, t+n, compare) ; 35 printf(" %s\n",t[0].num ) ; 36 } 37 } 38 return 0 ; 39 }
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4668596.html