最简解法:
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); double E = 0; for(int i = 1; i <= N; ++i) E += sc.nextInt()*Math.pow(2, N - i); System.out.println((int)Math.ceil(E/Math.pow(2, N))); } }