题目链接:https://ac.nowcoder.com/acm/contest/3005/G
题目大意:



思路:
每个人的分数为: a [ i ] ( 1 x ) + x y a[i]*(1-x)+x*y a[i](1x)+xy
要使: a [ i ] ( 1 x ) + x y 90 a[i]*(1-x)+x*y\geq90 a[i](1x)+xy90
就是: y 90 a [ i ] ( 1 x ) x y\geq\frac{90-a[i]*(1-x)}{x} yx90a[i](1x)
因为 y [ 0 , 90 ] y\in[0, 90] y[0,90]
所以: a [ i ] ( 1 x ) + x y 90 a[i]*(1-x)+x*y\geq90 a[i](1x)+xy90的概率:
90 90 a [ i ] ( 1 x ) x 90 \frac{90-\frac{90-a[i]*(1-x)}{x}}{90} 9090x90a[i](1x)
化简得:
( a [ i ] 90 ) ( 1 x ) 90 x \frac{(a[i]-90)(1-x)}{90x} 90x(a[i]90)(1x)
根据全概率公式:
p = ( a [ 1 ] 90 ) ( 1 x ) 90 x 1 n + ( a [ 2 ] 90 ) ( 1 x ) 90 x 1 n + . . . + ( a [ n ] 90 ) ( 1 x ) 90 x 1 n p=\frac{(a[1]-90)(1-x)}{90x}*\frac{1}{n}+\frac{(a[2]-90)(1-x)}{90x}*\frac{1}{n}+...+\frac{(a[n]-90)(1-x)}{90x}*\frac{1}{n} p=90x(a[1]90)(1x)n1+90x(a[2]90)(1x)n1+...+90x(a[n]90)(1x)n1
化简:
p = <munderover> i = 1 n </munderover> ( a [ i ] 90 ) ( 1 x ) 90 x n p=\sum_{i=1}^n\frac{(a[i]-90)(1-x)}{90xn} p=i=1n90xn(a[i]90)(1x)
因为: p = 0.1 p=0.1 p=0.1
所以: <munderover> i = 1 n </munderover> ( a [ i ] 90 ) ( 1 x ) 90 x n = 0.1 \sum_{i=1}^n\frac{(a[i]-90)(1-x)}{90xn}=0.1 i=1n90xn(a[i]90)(1x)=0.1
这里就可以用二分了。
可以化简到最后:
x = <munderover> i = 1 n </munderover> ( a [ i ] 90 ) 9 n + <munderover> i = 1 n </munderover> ( a [ i ] 90 ) x=\frac{\sum_{i=1}^n(a[i]-90)}{9n+\sum_{i=1}^n(a[i]-90)} x=9n+i=1n(a[i]90)i=1n(a[i]90)

#include <bits/stdc++.h>
using namespace std;

int a[100005];
int main(){
    int n, s=0;
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%d",&a[i]);
        s+=(a[i]-90);
    }
    printf("%.2f%%\n", 100.0*s/(9*n+s));

    return 0;
}