Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void beolvas(int a[],int &n,int &x)
- {
- cin>>n;
- for (int i=1;i<=n;i++)
- cin>>a[i];
- cin>>x;
- }
- bool divide_et_impera(int a[],int e,int v,int x)
- {
- if (e==v)
- return a[e]==x;
- int kozep=(e+v)/2;
- bool f1=divide_et_impera(a,e,kozep,x);
- bool f2=divide_et_impera(a,kozep+1,v,x);
- if (f1||f2)
- return 1;
- else
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement