标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 32767 Accepted Submission(s): 12898
#include <iostream> using namespace std; const int MAXN=30005; int minh[MAXN];//记录每个导弹拦截系统目前所能到达的最大高度 int n,h[MAXN]; int main() { while(cin>>n) { for(int i=0;i<n;i++) cin>>h[i]; int res=0; for(int i=0;i<n;i++) { int hh=MAXN; int k; for(int j=0;j<res;j++) { if(minh[j]>=h[i]&&minh[j]<hh) { hh=minh[j]; k=j; } } if(hh==MAXN) { minh[res]=h[i]; res++; } else minh[k]=h[i]; } cout<<res<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/program-ccc/p/5648096.html