/*
* Mafia.cpp
*
* Created on: 2013-10-12
* Author: wangzhu
*/ /**
* 每个人都想玩若干场,求至少需要玩几场才可以满足大家的需求。
* 结果必然在某个人想玩的次数nmax(此人想玩的是最多的)与所有人想玩的次数和sum之间,
* 故二分,left = nmax,right = sum,
* 只需要需要玩的次数 * (总人数-1) >= 大家想玩的次数和即可
*
*/
#include<cstdio>
#include<iostream>
using namespace std;
#define LL long long
#define NMAX 100010
int arr[NMAX];
LL binary(int n, int nmax, LL sum) {
LL mid = -, left = nmax, right = sum;
while (left <= right) {
mid = left + (right - left) / ;
if (sum <= (mid * n)) {
right = mid - ;
} else {
left = mid + ;
}
}
return left;
}
int main() {
freopen("data.in", "r", stdin);
int n, nmax;
LL sum;
while(~scanf("%d",&n)) {
nmax = -;
sum = ;
for(int i = ;i < n;i++) {
scanf("%d",arr + i);
if(nmax < arr[i]) {
nmax = arr[i];
}
sum += arr[i];
}
printf("%I64d\n",binary(n - ,nmax,sum)); }
return ;
}
05-06 16:08