fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int max_size = 14;
  5. int cnt_leaves(int x){
  6. if(x > max_size) return 0;
  7. if(x * 2 + 1 > max_size && x * 2 + 2 > max_size) return 1;
  8. return cnt_leaves(x * 2 + 1) + cnt_leaves(x * 2 + 2);
  9. }
  10.  
  11. int main(){
  12. cout << cnt_leaves(0) << endl;
  13. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
8