무작위로 라벨을 찍는 과정을 반복해 n마리의 여우가 모두 서로 구별될 때까지 걸리는 기대 시간을 분 단위로 구한다.
어려움9확률동적 계획법조합론아직 제출이 없습니다시간 제한3초메모리 제한512 MBBytica works in the biological expedition. Now she got n colored foxes for experiments. There's a problem, however: foxes of the same color are absolutely indistinguishable.
Now Bytica wants to mark the foxes with colored labels. She repeats the following steps until each pair of foxes becomes distinguishable:
Each procedure (three steps) takes exactly one minute.
Two foxes are considered to be distinguishable if their colors differ or sets of colors of their labels differ.
The only thing Bytica is unsure about now is the expected time before all foxes will be pairwise distinguishable. So she asked you to write a program to compute this value.
Input consists of two lines. The first line contains two integers n and k (1≤k<n≤30). The second line contains n integers, the i-th integer describes the initial color of the i-th fox.
Colors are denoted by positive integers not exceeding 1000.
Print one real number: the expected time in minutes before each pair of foxes becomes distinguishable. Your answer will be considered correct if its relative or absolute error is within 10−6.