加载中...

结绳

https://www.acwing.com/problem/content/1620/

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 10010;

int n;
double a[N];

int main()
{
    cin >> n;
    for (int i = 0; i < n; i ++ ) cin >> a[i];
    sort(a, a + n);

    for (int i = 1; i < n; i ++ ) a[0] = (a[0] + a[i]) / 2;

    printf("%d\n", (int)a[0]);

    return 0;
}



posted @ 2022-08-23 17:25  英雄不问出处c  阅读(23)  评论(0编辑  收藏  举报