solution.java 946 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
public class Main {
    static long[][] data = new long[30][30];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long factor = 1;/// 计量单位的数因子
        for (int i = 0; i < 30; i++) {
            factor <<= 1;
        }
        for (int i = 0; i < 29; ++i)// 输入数据放入二维数组(前29)
        {
            for (int j = 0; j <= i; ++j) {
                long a = sc.nextLong();
                data[i][j] = a * factor;
            }
        }
        for (int i = 0; i < 29; ++i) {
            for (int j = 0; j <= i; ++j) {
                long half = data[i][j] / 2;
                data[i + 1][j] += half;
                data[i + 1][j + 1] += half;
            }
        }
        Arrays.sort(data[29]);
        System.out.println(data[29][0]);
        System.out.println(data[29][29]);
        System.out.println(data[29][29] / (data[29][0] / 2086458231));
    }
}