Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define N 100005
- #define hell 1000000007
- int dp[125][12][725];
- int fun(int ball, int wick, int run) {
- if(run < 0) {
- return 0;
- }
- if(wick == 0) {
- return (run == 0);
- }
- if(ball == 0) {
- return (run == 0);
- }
- int& ans = dp[ball][wick][run];
- if(ans != -1) {
- return ans;
- }
- ans = fun(ball - 1, wick - 1, run);
- ans = (ans + fun(ball - 1, wick, run)) % hell;
- ans = (ans + fun(ball - 1, wick, run - 1)) % hell;
- ans = (ans + fun(ball - 1, wick, run - 4)) % hell;
- ans = (ans + fun(ball - 1, wick, run - 6)) % hell;
- return ans;
- }
- void solve() {
- int n;
- cin >> n;
- for(int i = 0; i < 121; i++) {
- for(int j = 0; j < 12; j++) {
- for(int k = 0; k < n + 1; k++) {
- dp[i][j][k] = -1;
- }
- }
- }
- cout << fun(120, 11, n) << endl;
- }
- int main()
- {
- int TESTS = 1;
- // cin >> TESTS;
- while(TESTS--)
- {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement