Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("file.in");
  7. ofstream fout("file.out");
  8.  
  9. int main()
  10. {
  11. int n,cnt=0;
  12. double x[1841];
  13. cin >> n;
  14. for(int i=1;i<=n;i++)
  15. cin >> x[i];
  16. for(int i=2;i<n;i++)
  17. {
  18. if(x[n]<=x[1])
  19. {
  20. if(x[i]>x[1] || x[i]<x[n])
  21. cnt++;
  22. }
  23. else
  24. {
  25. if(x[i]<x[1] || x[i]>x[n])
  26. cnt++;
  27. }
  28. }
  29. cout << cnt;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement