Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int a[1000], n;
- void Citire()
- {
- ifstream fin("fis.in");
- fin >> n;
- for(int i = 1; i <= n; i++)
- fin >> a[i];
- fin.close();
- }
- int Comp(int x)
- {
- if((a[x-1] < a[x])&&(a[x] > a[x+1])) return 1;
- return 0;
- }
- int DeI(int st, int dr)
- {
- if(st == dr)
- {
- if(st % 2 == 0) return Comp(st);
- return 1;
- }
- int m = (st+dr)/2;
- return DeI(st, m) && DeI(m+1, dr);
- }
- int main()
- {
- Citire();
- cout << DeI(1, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement