LegendRanger's blog

By LegendRanger, history, 7 days ago, In English

https://www.spoj.com/problems/ADASEA/ Anyone who can give me an explanation. I am not able to comprehend

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

»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it
This is an expected value problem. 
Expected value = value * probability_of_getting_this_value
Looking at cases 3 and 5 from the sample:
6/20 chance of landing on an island of size 2, 4/20 chance of landing on an island of size 4.
6 * 2 + 4 * 4 / 20 = 28 / 20 = 7 / 5
TC5:
6/16 chance of landing on an island of size 6, so the expected value is 6 * 6 / 16 = 9 / 4