Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#include <bits/stdc++.h>
- using namespace std;
- #define int long long
- const int N = 1e3 + 5;
- const int mod = 1e18 + 7;
- const int INF = 1e18;
- int dp[N];
- signed main()
- {
- int n , k;
- cin >> n >> k;
- dp[1] = 1;
- int sum = 1;
- for(int i = 2; i <= n; i++){
- dp[i] = sum;
- if((i - k) >= 0)
- sum -= dp[i - k];
- sum += dp[i];
- sum += mod;
- sum %= mod;
- }
- cout << dp[n] << endl;
- }*/
- /*
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- const int N = 1e3 + 5;
- const int mod = 1e9 + 7;
- const int INF = 1e18;
- int dp[N];
- signed main()
- {
- int n , k;
- cin >> n >> k;
- dp[1] = 1;
- for(int i = 2; i <= n; i++){
- for(int j = (i - 1); j >= max(i - k , 0LL); j--){
- dp[i] += dp[j];
- }
- }
- cout << dp[n] << endl;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement