Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool peak(int n1, int n2, int n3) {
- if (n1<n2&&n2>n3) return true;
- else return false;
- }
- int main() {
- int n1,n2,n3;
- bool higherPeak=false;
- cin>>n1;
- cin>>n2;
- while(cin>>n3&&n3!=0) {
- if (peak(n1,n2,n3)&&n2>3143) higherPeak=1;
- n1=n2;
- n2=n3;
- }
- if (higherPeak) cout<<"YES"<<endl;
- else cout<<"NO"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment