Meaning of the questions:
Two sequences of length M and a B, which required each number between 1 and N, while the array is not a decrement, b array is not incremented, and for all elements, a (i) <b (i), ask how many such sequences ab, the result of the modulo 1e9 + 7
answer:
B flip sequence, and with a combined sequence is a length of 2 * M is not strictly decreasing sequence, this problem and minimize the number of sequence types.
Dp opening a two-dimensional array, i represents the number of bits after the first program in the digital zoom is equal to j, and the state transition equation is derived:
dp(i)(j)=dp(i)(j+1)+dp(i-1)(j)
Time complexity is O (M * N)
#include <bits / STDC ++ H.> the using namespace STD; typedef Long Long LL; const int MAXN = 1E3 + 100 ; const int MOD = 1E9 + . 7 ; LL DP [MAXN << . 1 ] [MAXN]; // DP [I] [j] denotes the i-th position may be enlarged to the number of programs is equal to j, int main () { int N, M; Scanf ( " % D% D " , & N, & M); for ( int i = . 1 ; i < N =; I ++ ) DP [ . 1 ] [I] = . 1; for (int i=2;i<=2*M;i++) { for (int j=N;j>=1;j--) dp[i][j]=(dp[i][j+1]+dp[i-1][j])%mod; } ll ans=0; for (int i=1;i<=N;i++) ans+=dp[2*M][i],ans%=mod; printf("%lld\n",ans); }