Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n, k;
- cin >> n >> k;
- vector<vector<int>> stir(n + 1, vector<int>(k + 1));
- stir[0][0] = 1;
- for (int i = 1; i <= n; i++)
- {
- for (int j = 1; j <= min(i, k); j++)
- stir[i][j] = stir[i - 1][j - 1] + j * stir[i - 1][j];
- }
- cout << stir[n][k] << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement