Advertisement
rofllmaolol

pr2divide

Jan 29th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int v[100],k=0,n;
  4. void f(int li,int ls)
  5. {
  6. int lm;
  7. if(li==ls) {if(v[li]%2==0) k++;}
  8. else
  9. {
  10. lm=(li+lm)/2;
  11. f(li,lm);
  12. f(lm+1,ls);
  13. }
  14. }
  15. main()
  16. {
  17. int i;
  18. cin>>n;
  19. for(i=1;i<=n;i++) cin>>v[i];
  20. f(1,n);
  21. cout<<k;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement