NYOJ 79 Interceptor missiles

Source: Internet
Author: User

Interceptor missiles

Describe

A country has developed a missile interception system to defend against enemy missile attacks. But the missile interception system has a flaw: although its first shells can reach any height, each shot cannot be higher than the height of the previous one. One day, the radar caught the enemy missiles to attack. Since the system is still in the trial phase, it is possible to intercept all missiles by using only one set of systems.

Input
number of input test data groups in the first row N (1<=n<=10)
The next line is to enter the number of missile m (1<=m<=20) for this set of test data.
The next line is to enter the height of the missile in turn, and all the height values are positive integers greater than 0.
Output
outputs the maximum number of missiles to intercept
Sample input
28389 207 155 300 299 170 158 65388 34 65
Sample output
62

1#include <cstdio>2#include <algorithm>3#include <cstring>4 using namespacestd;5 6 intMain ()7 {8     //freopen ("In.txt", "R", stdin);9     intp[ +];Ten     intdp[ +]; One     inti,j,n,t; Ascanf"%d",&t); -      while(t--) -     { thescanf"%d",&n); -Memset (DP,0,sizeof(DP)); -         intans=0; -          for(i=0; i<n;i++) +scanf"%d",&p[i]); -          for(i=0; i<n;i++) +         { Adp[i]=1; at              for(j=0; j<i;j++) -             if(p[j]>P[i]) -Dp[i]=max (dp[i],dp[j]+1); -ans=Max (ans,dp[i]); -         } -printf"%d\n", ans); in     } -}

NYOJ 79 Interceptor missiles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.