Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int A[1001],n,ok=1,s,d;
- cin>>n;
- for(int i=1;i<=n;i++)
- cin>>A[i];
- s=A[1];
- d=A[n];
- if(s>d)
- {
- int aux=s;
- s=d;
- d=aux;
- }
- for(int i=1;i<=n;i++)
- if(A[i]<s || A[i]>d) ok=0;
- if(ok==1) cout<<"DA";
- else cout<<"NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement