no_life's blog

By no_life, history, 6 years ago, In English

This problem came on TCS mockvita 2018.Here is a link to problem — https://www.programminggeek.in/2018/07/mockvita-2018-problem-heights-of.html?m=1

Any idea how to solve this?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By no_life, history, 6 years ago, In English

We all know that the number of solutions to a+b = 3 (where a and b are non negative) can be easily found out by stars and bars theorem. So answer of the above is 4. { (3,0),(0,3),(1,2),(2,1)}. But I want the answer to be 2 as the first two and last two are equivalent. Formally, as the stars and bars give the number of ordered sets, I want to find out the number of unordered sets.

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

By no_life, history, 6 years ago, In English

Given N numbers(A[0], A[1], ...., A[N-1]) and two prime numbers P, Q. Determine the number of subsets whose product is divisible by P*Q.

2<=N<300, P, Q <= 50, A[i] <= 10,000

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it