#include <stdio.h> #include <algorithm> using namespace std; /* Codeforces */ /*****************************************************************************/ int main(void) { int n, a; long long m=0, s=0; scanf("%d", &n); for (int i=0; i<n; i++) { scanf("%d", &a); s+=a; m=max(m, (long long)a); } long long l=0, h=2e9+1, ans; while (l<=h) { long long mid=(l+h)/2; if (mid*(n-1)>=s) { h=mid-1; ans=mid; } else l=mid+1; } printf("%I64d\n", max(m, ans)); return 0; } /*****************************************************************************/
Codeforces 202 DIV2 C
简单的二分查找:..
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment