CF1776K.Uniform Chemistry
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In a parallel universe there are n chemical elements, numbered from 1 to n . The element number n has not been discovered so far, and its discovery would be a pinnacle of research and would bring the person who does it eternal fame and the so-called SWERC prize.
There are m independent researchers, numbered from 1 to m , that are trying to discover it. Currently, the i -th researcher has a sample of the element si . Every year, each researcher independently does one fusion experiment. In a fusion experiment, if the researcher currently has a sample of element a , they produce a sample of an element b that is chosen uniformly at random between a+1 and n , and they lose the sample of element a . The elements discovered by different researchers or in different years are completely independent.
The first researcher to discover element n will get the SWERC prize. If several researchers discover the element in the same year, they all get the prize. For each i=1,2,…,m , you need to compute the probability that the i -th researcher wins the prize.
输入格式
The first line contains two integers n and m ( 2≤n≤1018 , 1≤m≤100 ) — the number of elements and the number of researchers.
The second line contains m integers s1,s2,…,sm ( 1≤si<n ) — the elements that the researchers currently have.
输出格式
Print m floating-point numbers. The i -th number should be the probability that the i -th researcher wins the SWERC prize. Your answer is accepted if each number differs from the correct number by at most 10−8 .
输入输出样例
输入#1
2 3 1 1 1
输出#1
1.0 1.0 1.0
输入#2
3 3 1 1 2
输出#2
0.5 0.5 1.0
输入#3
3 3 1 1 1
输出#3
0.625 0.625 0.625
输入#4
100 7 1 2 4 8 16 32 64
输出#4
0.178593469 0.179810455 0.182306771 0.187565366 0.199300430 0.229356322 0.348722518
说明/提示
In the first sample, all researchers will discover element 2 in the first year and win the SWERC prize.
In the second sample, the last researcher will definitely discover element 3 in the first year and win the SWERC prize. The first two researchers have a 50% chance of discovering element 2 and a 50% chance of discovering element 3 , and only element 3 will bring them the prize.
In the third sample, each researcher has an independent 50% chance of discovering element 3 in the first year, in which case they definitely win the SWERC prize. Additionally, if they all discover element 2 in the first year, which is a 12.5% chance, then they will all discover element 3 in the second year and all win the prize.