secomo's blog

By secomo, history, 3 years ago, In English

Example : {1,2,2,3,3}

the answer here is 5 :

{1,2,2} {1,2,3} {1,3,3} {2,2,3} {2,3,3}

I want a formula to calculate this.

I searched through Internet but I did not find a clear answer.

I am not good at math so I want a simple explination If that is possible. Thank you.

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

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Helppppp Plssss

»
3 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

https://cses.fi/book/book.pdf Page 72 (Of the book, not pdf) . Slightly change the algorithm and it should work

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

here is a beautiful solution from aops using generating functions. I don't know generating functions too much, but I understood the solution.