雯舞

Love three things int he world -- Manchery

[杂题] Codeforces 830C Round #424 Div1 C. Bamboo Partition

随便搞搞吧

#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;

#define read(x) scanf("%d",&(x))

const int maxn=200005;
const int P=1e9+7;

const int N=505;

int n,a[N];

inline ll check(ll d){
  ll ret=0;
  for (int i=1;i<=n;i++)
    ret+=(a[i]+d-1)/d;
  return ret;
}
ll K;

ll sx[10000005],icnt;

int main(){
  freopen("t.in","r",stdin);
  freopen("t.out","w",stdout);
  read(n); scanf("%I64d",&K);
  for (int i=1;i<=n;i++)
    read(a[i]),K+=a[i];
  ll ans=0;
  for (ll i=1,j;i<=K;i=j+1){
    j=K/(K/i);
    if (check(j)<=K/j)
      ans=max(j,ans);
  }
  printf("%I64d\n",ans);
  return 0;
}
阅读更多
版权声明:本文为博主原创文章,未经博主允许随意转载。 https://blog.csdn.net/u014609452/article/details/75974550
个人分类: 杂题
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭