A:枚举答案即可。注意答案最大可达201,因为这个wa了一发瞬间爆炸。

#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
    int x=0,f=1;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
#define N 110
int n,a[N],mx;
int main()
{
/*#ifndef ONLINE_JUDGE
    freopen("a.in","r",stdin);
    freopen("a.out","w",stdout);
#endif*/
    n=read();
    int tot=0;
    for (int i=1;i<=n;i++) mx=max(mx,a[i]=read()),tot+=a[i];
    for (int i=mx;i<=201;i++)
    {
        int cnt=0;
        for (int j=1;j<=n;j++) cnt+=i-a[j];
        if (cnt>tot) {cout<<i;return 0;}
    }
    return 0;
}
View Code

相关文章:

  • 2022-01-18
  • 2022-02-26
  • 2021-10-26
  • 2022-02-12
  • 2021-10-07
  • 2022-02-20
  • 2021-05-30
  • 2021-09-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案