Poj 3183 stump removal (simple question)

Source: Internet
Author: User

[Description]: This is the tree pile. When it is higher than the tree pile around it, it can blow up the tree pile around it. Now let's use the least explosive stuff to blow up all the piles and ask which ones they are all placed on.

[Analysis]: A simple simulation, using the greedy law, as long as the tree pile is higher than other trees around it, it is enough to output its position.

However, pay attention to the processing of the boundary!

// 412 K 516 Ms # include <iostream> using namespace STD; int stump [50005]; int main () {int N; CIN> N; for (INT I = 1; I <= N; I ++) CIN> stump [I]; If (stump [1]> = stump [2]) cout <1 <Endl; For (INT I = 2; I <= N; I ++) {if (I = N) {If (stump [I]> = stump [I-1]) cout <I <Endl ;} else {If (stump [I]> = stump [I-1] & stump [I]> = stump [I + 1]) cout <I <Endl ;}} return 0 ;}


Poj 3183 stump removal (simple question)

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.