[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)