Water problem ... Forget to take the mold there is no 1 a ....
---------------------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;const int MOD = 5000011;const int MAXN = 100009;int DP[MAXN], n, K;int main () {cin >> n >> K;for (int i = 0; I <= k; i++)Dp[i] = i + 1;for (int i = k + 1; I <= n; i++)Dp[i] = (Dp[i-1] + dp[i-k-1])% MOD;cout << dp[n] << "\ n";return 0;}
---------------------------------------------------------------------------
3398: [Usaco2009 feb]bullcow Bull and Cow time limit: 1 Sec Memory Limit: MB
Submit: Solved: 54
[Submit] [Status] [Discuss] DescriptionJohn is going to take N (1≤n≤100000) cattle to the show at the rally, which can be bull or cow. The cows were to stand in a row. But the bull was aggressive, and John decided to have at least K (o≤k<n) cow between any two bulls in order to avoid the bull's trouble. Please calculate how many kinds of queueing methods are in common. All bulls can be seen as the same, and all cow are the same. Answer to 5000011 modulo inputone line, enter two integers n and K.OutputAn integer that represents the number of methods queued. Sample Input4 2
Sample Output6
Sample Description
6 methods are: Doe DOE DOE Doe, Hart Doe Doe DOE, DOE DOE Doe, DOE Doe Hart Doe, DOE Doe Doe Hart, Hart Doe Doe HartHINT
Source
Silver
Bzoj 3398: [Usaco2009 feb]bullcow Bull and Cow (DP)