标签:des style blog io color ar sp for div
1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 int N; 6 int M; 7 int i; 8 char ID[16]; 9 char minID[16]; 10 char maxID[16]; 11 char s1[9]; 12 char s2[9]; 13 char time1[7]; 14 char time2[7]; 15 char minTime[7]; 16 char maxTime[7]; 17 18 scanf("%d",&N); 19 20 while(N--){ 21 scanf("%d",&M); 22 23 for(i=0;i<M;i++){ 24 scanf("%s%s%s",ID,s1,s2); 25 time1[0]=s1[0]; 26 time1[1]=s1[1]; 27 time1[2]=s1[3]; 28 time1[3]=s1[4]; 29 time1[4]=s1[6]; 30 time1[5]=s1[7]; 31 time1[6]=‘\0‘; 32 33 time2[0]=s2[0]; 34 time2[1]=s2[1]; 35 time2[2]=s2[3]; 36 time2[3]=s2[4]; 37 time2[4]=s2[6]; 38 time2[5]=s2[7]; 39 time2[6]=‘\0‘; 40 41 if(i==0){ 42 strcpy(minID,ID); 43 strcpy(maxID,ID); 44 strcpy(minTime,time1); 45 strcpy(maxTime,time2); 46 continue; 47 } 48 49 if(strcmp(time1,minTime)<0){ 50 strcpy(minID,ID); 51 strcpy(minTime,time1); 52 } 53 54 if(strcmp(time2,maxTime)>0){ 55 strcpy(maxID,ID); 56 strcpy(maxTime,time2); 57 } 58 } 59 60 printf("%s %s\n",minID,maxID); 61 62 63 } 64 65 66 return 0; 67 }
标签:des style blog io color ar sp for div
原文地址:http://www.cnblogs.com/zqxLonely/p/4087740.html