Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- void jump(int pos, short n, short k);
- unsigned long long m = 0;
- int main()
- {
- short k,n;
- cin >> k >> n;
- jump(0, n, k);
- cout << m << endl;
- return 0;
- }
- void jump(int pos, short n, short k)
- {
- int i;
- for(i = 1; i <= k; i++)
- if (!(pos + i > n)){
- if(pos + i == n)
- m++;
- else
- jump(pos+i, n, k);
- } else continue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement