Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

dimiTree's blog

By dimiTree, history, 2 months ago, In English

We are given n disjoint, finite sets.

We would like to count the amount of all possible subsets, while having the following restriction: we are only allowed to include a max of one element each out of every of our n disjoint sets.

My initial thought was to count all possible subsets of size {0, 1, ..., n} and sum them up.

Code

There is probably a much more elegant and efficient solution out there.

Feel free to share your ideas!

Read more »

 
 
 
 
  • Vote: I like it
  • +4
  • Vote: I do not like it