Advertisement
CosmicFox33

Untitled

Jan 29th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int c;
  5. void f(int n, int d){
  6.     if(n<3) return;
  7.     if(n==3 && d==0) c++;
  8.     f(n-1, d-1);
  9.     f(n-4, d-1);
  10.     if(n%2==0) f(n/2, d-1);
  11. }
  12.  
  13. int main()
  14. {
  15.     f(27, 7);
  16.     cout << c;
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement