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?
# | User | Rating |
---|---|---|
1 | tourist | 3845 |
2 | jiangly | 3707 |
3 | Benq | 3630 |
4 | orzdevinwang | 3573 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | jqdai0815 | 3532 |
8 | ecnerwala | 3501 |
9 | gyh20 | 3447 |
10 | Rebelz | 3409 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 171 |
2 | adamant | 163 |
2 | awoo | 163 |
4 | TheScrasse | 154 |
5 | nor | 153 |
6 | maroonrk | 152 |
6 | -is-this-fft- | 152 |
8 | Petr | 145 |
9 | pajenegod | 144 |
9 | orz | 144 |
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?
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.
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
Name |
---|