标签:des style class blog c code
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 int n,a[105],b[105],i,j,sign,num,k; 7 while(scanf("%d",&n),n!=0) 8 { 9 for(i=0;i<n;i++) 10 scanf("%d %d",&a[i],&b[i]); 11 for(i=n-1;i>=0;i--) 12 { 13 k=i; 14 for(j=i-1;j>=0;j--) 15 if(b[k]<b[j])k=j; 16 if(k!=i) 17 { 18 num=b[i];b[i]=b[k];b[k]=num; 19 num=a[i];a[i]=a[k];a[k]=num; 20 } 21 } 22 for(i=1,num=b[0],sign=1;i<n;i++) 23 { 24 if(a[i]>=num) 25 { 26 num=b[i]; 27 sign++; 28 } 29 } 30 printf("%d\n",sign); 31 } 32 return; 33 }
标签:des style class blog c code
原文地址:http://www.cnblogs.com/LWF5201314614/p/3750315.html