algorithm - Number of subsets of size 'k' whose sum when taken mod with 'p' gives 'x' -


given: set of size n integer elements in range [1,p] , integer k<=n

suppose function

f(a subset) = (sum of elements in subset)%p 

i need find each x such 0<=x<=p-1 how many subsets of size k have

f( subset ) = x 

a dp solution complexity npk trivial there n*p solution?


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -