Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int c;
- void f(int n, int d){
- if(n<3) return;
- if(n==3 && d==0) c++;
- f(n-1, d-1);
- f(n-4, d-1);
- if(n%2==0) f(n/2, d-1);
- }
- int main()
- {
- f(27, 7);
- cout << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement