Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[100],n;
- int pare(int st, int dr)
- {
- int p1,p2,mij=(st+dr)/2;
- if(st==dr)
- if(a[st]%2==0)
- return 1;
- else return 0;
- else
- {
- p1=pare(st,mij);
- p2=pare(mij+1,dr);
- return p1+p2;
- }
- }
- int main()
- {
- int i;
- cin>>n;
- for(i=1;i<=n;i++) cin>>a[i];
- cout<<pare(1,n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement