标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 29960 Accepted Submission(s): 11754
1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 5 const int MAX=100000; 6 const int INF=0x7ffffff; 7 int b[MAX]; 8 int main() 9 { 10 int n,count,num; 11 bool catchSuc; 12 while(scanf("%d",&n)==1) 13 { 14 count=0; 15 for(int i=0;i<n;i++) 16 { 17 scanf("%d",&num); 18 catchSuc=false; 19 int pos,temp=INF; 20 for(int j=0;j<count;j++) 21 { 22 if(num<=b[j]&&temp>b[j]) 23 { 24 catchSuc=true; 25 temp=b[j]; 26 pos=j; 27 } 28 } 29 if(catchSuc) 30 { 31 b[pos]=num; 32 } 33 else 34 { 35 b[count]=num; 36 count++; 37 } 38 } 39 printf("%d\n",count); 40 } 41 }
标签:
原文地址:http://www.cnblogs.com/cumulonimbus/p/5158739.html