Dp problem- topcoder SRM 694 (level 3, Div 1)

Revision en1, by CazadorDivino, 2016-07-17 00:11:47
int count(int N, int K){
	dp[0][0] = 1;
	for(int i = 0; i < N; i++){
		for(int j = 0; j <= K; j++){
			for( int a = 0; a <= i; a++){
				print(N,K);
				if(j+a*(i-a) > K || dp[i][j] == 0){ continue;}
				
				dp[i+1][j+a*(i-a)] += dp[i][j];
				dp[i+1][j+a*(i-a)] %= MOD;
				
			}
			
		}
	}
	return dp[N][K];
}

Help me with dis dp code, I can't undestand. https://community.topcoder.com/stat?c=problem_statement&pm=14304

Tags srm 694, dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English CazadorDivino 2016-07-17 00:11:47 505 Initial revision (published)