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<1 || d<0) return;
- if(n==1 && d==0) c++;
- f(n-1, d-1);
- if(n%2==0) f(n/2, d-1);
- f(n-2, d-1);
- }
- int main()
- {
- for(int i=1; i<100; i++){
- c=0;
- f(28, i);
- if(c!=0) break;
- }
- cout << c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement