Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #include <math.h>
- #include <set>
- #include <map>
- #include <queue>
- #include <deque>
- #include <stack>
- #define f first
- #define s second
- using namespace std;
- long long a[100];
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- int n, k;
- cin >> n >> k;
- a[1] = 1;
- for (int i = 1; i <= n; i++)
- for (int j = i - 1; j >= max(0, i - k); j--)
- a[i] += a[j];
- //for (int i = 2; i <= n; i++)
- // cout << a[i] << " ";
- // cout << endl;
- cout << a[n];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement