Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int A[1001],n,ok=1,s,d;
  8. cin>>n;
  9. for(int i=1;i<=n;i++)
  10. cin>>A[i];
  11. s=A[1];
  12. d=A[n];
  13. if(s>d)
  14. {
  15. int aux=s;
  16. s=d;
  17. d=aux;
  18. }
  19. for(int i=1;i<=n;i++)
  20. if(A[i]<s || A[i]>d) ok=0;
  21. if(ok==1) cout<<"DA";
  22. else cout<<"NU";
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement