Submission

Status:

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

Subtask/Task Score:

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

Score: 100

User: 85

Problemset: นก

Language: cpp

Time: 0.002 second

Submitted On: 2026-02-15 16:47:34

#include <iostream>
using namespace std;
int main(){
	int n,c = 0;
	cin>>n;
	int a[n];
	for(int i= 0;i < n;i++){
		cin>>a[i];	
	}
	for(int i= 0;i < n;i++){
		if( i == 0){
			if(a[i] > a[i+1]){
				c += 1;
			}
		}
		else if(i == n-1){
			if(a[i] > a[i-1]){
				c += 1;
			}
		}
		else{
			if(a[i]>a[i-1] && a[i]>a[i+1]){
				c+=1;
			}
		}
		
		
	}
	
cout<<c;
return 0;	
	

}