标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
#include<stdio.h> #include<string.h> #include<algorithm> #define max 1000+10 using namespace std; struct record { char name[20]; char come[10]; char go[10]; }num[max]; bool cmp(record a,record b) { return strcmp(a.come,b.come)<0; //签到排序 } bool cmp1(record a,record b) { return strcmp(a.go,b.go)>0; //签退排序 } int main() { int t,n,i,j; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=0;i<n;i++) scanf("%s %s %s",num[i].name,num[i].come,num[i].go); sort(num,num+n,cmp); printf("%s ",num[0].name); sort(num,num+n,cmp1); printf("%s\n",num[0].name); } return 0; }
Total Submission(s): 11667 Accepted Submission(s):
5934
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4354336.html