SRM531

div2-mid
めもめも

#include<iostream>
#include<algorithm>
using namespace std;
class NoRepeatPlaylist
{
public:
	int numPlaylists(int N, int M, int P)
	{
		long long dp[105][105] = {0};
		dp[0][0] = 1;
		for(int i=1; i<=P; ++i)
		{
			for(int j=1;j<=N;++j)
			{
				dp[i][j] += ( dp[i-1][j-1]*max(N-(j-1),0) + dp[i-1][j]*max(j-M,0) ) % 1000000007;
			}
		}
		int result = dp[P][N];
		return result;
	}
};