答案可以取小数,但是要向上取整输出
import java.util.*;
public class Main{
static int n;
static double qe=1e-8;
static int q[]=new int[100010];
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
for(int i=1;i<=n;i++) q[i]=sc.nextInt();
double l=1,r=100000;
while(r-l>qe){
double mid=(l+r)/2;
if(check(mid)) r=mid;
else l=mid;
}
int a=(int)(r+1);
System.out.println(a);
}
static boolean check(double e){
for(int i=1;i<=n;i++){
if( q[i]>e ) e-=q[i]-e;
else e+=e-q[i];
if(e<0) return false;
}
return true;
}
}