题目链接:http://codeforces.com/problemset/problem/348/A
代码:
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main() { //freopen("E:\acm\input.txt","r",stdin); int n; scanf("%d",&n); long long L,R; L = R = 0; for(int i=1; i<=n; i++) { long long a; scanf("%I64d",&a); R += a; L = max(L,a); } long long sum = R; while(L < R) { long long mid = (L + R)/2; if( mid*(n-1) < sum) L = mid + 1; else R = mid; } printf("%I64d ",L); }