69,370
社区成员
发帖
与我相关
我的任务
分享
#include "stdio.h"
#define DEBUG
typedef struct vidio{
int start;
int end;
}Love, *pLove;
Love my[101];
int size;
void Insert(int loc){
int i;
Love temp = my[loc];
for(i=loc-1; i>=0; i--)
if(my[i].end>temp.end)
my[i+1] = my[i];
else
break;
my[i+1] = temp;
}
void main(){
int i, j, c;
pLove now;
#ifdef DEBUG
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
while(scanf("%d", &size), size){
scanf("%d %d", &my[0].start, &my[0].end);
for(i=1; i<size; i++){
scanf("%d %d", &my[i].start, &my[i].end);
Insert(i);
}
now = my+0; c=1;
for(j=1; j<size && (now->end<=24); j++)
if((my[j].start) >= (now->end)){
c++;
now = my+j;
}
printf("%d\n", c);
}
}