HDU 1257 Minimum interception system

Source: Internet
Author: User
Tags radar

Minimum interception system

Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 29960 Accepted Submission (s): 11754


problem DescriptionA missile interception system has been developed by a country to defend against enemy missile attacks. But there is a flaw in the missile interception system: Although its first shells can reach any height, each shot cannot exceed the height of the previous one. Someday, The radar captures the enemy's missiles. Since the system is still in trial, there is only one set of systems that may not intercept all missiles.
What do we do? How many systems do you have? It's easy to say it. Cost is a big problem. So I came here to call for help, please figure out how many sets of interception systems you need at least. 

Inputenter several sets of data. Each group of data includes: Total number of missiles (positive integers), the height at which the missiles are flown (radar-given height data is a positive integer not greater than 30000, separated by a space) 

Outputcorresponding to each set of data output intercept all missiles with a minimum of how many sets of this missile interception system. 

Sample Input8 389 207 155 299 158 

Sample Output2 

SourceThe Fourth annual college student Program Design Competition of Zhejiang University of Technology 

recommendjgshiningMany of the ideas on the Internet are overlooked.
1#include <cstdio>2#include <algorithm>3 using namespacestd;4 5 Const intmax=100000;6 Const intinf=0x7ffffff;7 intB[max];8 intMain ()9 {Ten     intN,count,num; One     BOOLcatchsuc; A      while(SCANF ("%d", &n) = =1) -     { -Count=0; the          for(intI=0; i<n;i++) -         { -scanf"%d",&num); -Catchsuc=false; +             intpos,temp=INF; -              for(intj=0; j<count;j++) +             { A                 if(num<=b[j]&&temp>B[j]) at                 { -Catchsuc=true; -temp=B[j]; -pos=J; -                 } -             } in             if(CATCHSUC) -             { tob[pos]=num; +             } -             Else the             { *b[count]=num; $count++;Panax Notoginseng             } -         } theprintf"%d\n", count); +     } A}

HDU 1257 Minimum interception system

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.