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
Post a Comment