标签:
Description
Input
Output
Sample Input
Sample Output
1 #include<stdio.h> 2 #define M 9999999 3 4 int main() 5 { 6 int i,k,n,high,cnt,mini,min[10010],minNum; 7 int flag1,flag2; 8 9 while(scanf("%d",&n)!=EOF) 10 { 11 cnt = 0; 12 flag1 = 0; 13 for(k=0;k<n;k++) 14 { 15 scanf("%d",&high); 16 if(flag1==0) 17 { 18 cnt = 1; 19 flag1 = 1; 20 min[cnt] = high; 21 continue; 22 } 23 flag2 = 0; 24 minNum = M; 25 for(i=1;i<=cnt;i++) 26 { 27 if(min[i]-high<0) 28 continue; 29 if(min[i]<minNum) 30 { 31 minNum = min[i]; 32 mini = i; 33 } 34 if(i==cnt) 35 { 36 min[mini]=high; 37 flag2 = 1; 38 } 39 } 40 if(flag2==0) 41 { 42 cnt++; 43 min[cnt]=high; 44 } 45 } 46 printf("%d\n",cnt); 47 } 48 return 0; 49 }
标签:
原文地址:http://www.cnblogs.com/yoghurtman/p/4679603.html