Solution:
For the first time, the average value of the obtained gold coins is sum/n. sum, which is the sum of the gold coins in all shards.
If you are lucky, you can roll it back and get M/N * (sum/n) in this round)
Good luck. Come again, this round can get (M/N) ^ 2 * (sum/N)
The sum/N * (1 + P ^ 2 + '''' + P ^ K + '''') can be obtained through endless shaking ''''), where p = M/N
After the formula is simplified, E = sum/(n-m) is obtained ). So when sum = 0 is 0, n = m is INF. The rest are sum/(n-m ).
# Include "stdio. H"
Int main ()
{
Int n, m, I, K, H, sum;
While (scanf ("% d", & M )! = EOF)
{
Sum = 0;
For (I = 0; I <m; I ++)
{
Scanf ("% d", & N );
Sum + = N;
}
Scanf ("% d", & K );
For (I = 0; I <K; I ++)
Scanf ("% d", & H );
If (sum = 0) although when m> K, as long as sum = 0, can also be calculated as 0,
Printf ("0.00 \ n ");
Else if (M> K)
Printf ("%. 2lf \ n", (double) 1.0 * sum/(m-k ));
Else if (M = K)
Printf ("INF \ n ");
}
Return 0;
}