Advertisement
J00ker

.

Dec 3rd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int a[1000], n;
  7.  
  8. void Citire()
  9. {
  10. ifstream fin("fis.in");
  11. fin >> n;
  12. for(int i = 1; i <= n; i++)
  13. fin >> a[i];
  14. fin.close();
  15. }
  16.  
  17. int Comp(int x)
  18. {
  19. if((a[x-1] < a[x])&&(a[x] > a[x+1])) return 1;
  20. return 0;
  21. }
  22.  
  23. int DeI(int st, int dr)
  24. {
  25. if(st == dr)
  26. {
  27. if(st % 2 == 0) return Comp(st);
  28. return 1;
  29. }
  30. int m = (st+dr)/2;
  31. return DeI(st, m) && DeI(m+1, dr);
  32. }
  33.  
  34. int main()
  35. {
  36. Citire();
  37. cout << DeI(1, n);
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement