Mafia CodeForces - 348A

原题链接
考察:思维
思路:
  设和为\(sum\),每次减少\(n-1\),最多进行\(\frac{sum+n-2}{n-1}\)次.但是存在\(a[i]\)彼此相差悬殊的情况.此时答案为\(max(a[i])\).

Code

#include <iostream>
#include <cstring>
using namespace std;
typedef long long LL;
int n,maxn;
LL sum;
int main()
{
	scanf("%d",&n);//if a[i]相差悬殊 
	for(int i=1,x;i<=n;i++) scanf("%d",&x),sum+=(LL)x,maxn = max(x,maxn);
	maxn = max((sum+(n-2))/(n-1),1ll*maxn);
	printf("%d\n",maxn); 
	return 0;
}
posted @ 2021-07-24 00:10  acmloser  阅读(36)  评论(0编辑  收藏  举报