AC

robin88  •  5个月前


include<bits/stdc++.h>

using namespace std; / run this program using the console pauser or add your own getch, system("pause") or input loop /

int main(int argc, char** argv) {

int total=0;
cin>>total;
int num[total]={0};
for(int i=0;i<total;i++){
	cin>>num[i];
}
for(int j=1;j<total-1;j++){
	if(num[j]>num[j-1] && num[j]>num[j+1]){
		cout<<num[j]<<" ";
	}
}
return 0;

}


评论:

请先登录,才能进行评论