/* Minimum interception system
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 25347 Accepted Submission (s): 9959
Problem Description
A country has developed a missile interception system to defend against enemy missile attacks. But there is a flaw in this missile-blocking system:
Although its first shells can reach any height, each projectile cannot exceed the height of the previous one.
One day, the radar caught the enemy's missiles. Since the system is still in the trial phase, there is only one set of systems,
It is therefore possible that all missiles cannot be intercepted.
What do we do? How many systems do you have? It's easy to say, cost? Cost is a big problem.
So I came here to ask for help, please figure out how many sets of interception system you need at least.
Input
Enter several sets of data. Each group of data includes: Total number of missiles (positive integers), the height at which the missiles fly
(Radar-given height data is a positive integer not greater than 30000, separated by a space)
Output
corresponding to each set of data output intercept all missiles with a minimum of how many sets of this missile interception system.
Sample Input
8 389 207 155 300 299 170 158 65
Sample Output
2*/
<span style= "FONT-SIZE:18PX;" > #include <stdio.h> #include <string.h>int a[1000008],b[1000008];int main () {int n,i,k,j; while (scanf (" %d ", &n) ==1) { k=0; scanf ("%d", &a[0]); B[K]=A[0]; for (i=1;i<n;i++) { scanf ("%d", &a[i]); for (j=0;j<=k;j++) if (B[j]>a[i]) { b[j]=a[i]; break; } if (j>k) { b[++k]=a[i]; } } printf ("%d\n", k+1); } return 0;} </span>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
HDOJ 1257 Minimum interception system