Submission

Status:

[PPPP][P][P][P][P]

Subtask/Task Score:

{20/20}{20/20}{20/20}{20/20}{20/20}

Score: 100

User: sssctngs

Problemset: นก

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-27 22:00:26

#include <iostream>

using namespace std;

int main(){
	int x;
	cin >> x;
	int Tree[x];
	int Bird = 0;
	for(int i = 0; i < x; i++){
		cin >> Tree[i];
	}
	for(int i = 0; i < x; i++){
		
		if(i == 0){
			if(Tree[i] > Tree[i+1]){
				Bird++;
			}
		}
		else if(i == x-1){
			if(Tree[i] > Tree[i-1]){
				Bird++;
			}
		}
		else {
			
		if(Tree[i] > Tree[i-1] && Tree[i] > Tree[i+1]){
		
			Bird++;
		}
	}
	}
	cout << Bird << "";
}