/ Vijos / 讨论 / 羽毛 /

大牛进来看看吧

评测结果

编译成功

测试数据 #0: Accepted, time = 0 ms, mem = 556 KiB, score = 10

测试数据 #1: Accepted, time = 0 ms, mem = 556 KiB, score = 10

测试数据 #2: Accepted, time = 15 ms, mem = 552 KiB, score = 10

测试数据 #3: Accepted, time = 0 ms, mem = 560 KiB, score = 10

测试数据 #4: Accepted, time = 0 ms, mem = 552 KiB, score = 10

测试数据 #5: Accepted, time = 15 ms, mem = 552 KiB, score = 10

测试数据 #6: Accepted, time = 0 ms, mem = 556 KiB, score = 10

测试数据 #7: WrongAnswer, time = 0 ms, mem = 556 KiB, score = 0

测试数据 #8: WrongAnswer, time = 15 ms, mem = 552 KiB, score = 0

测试数据 #9: WrongAnswer, time = 0 ms, mem = 556 KiB, score = 0

WrongAnswer, time = 45 ms, mem = 560 KiB, score = 70

代码

#include <cstdio>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,a[20005],c1;
int s=0;
int mx=-1;
int abs (int x){
if (x<0)
return -x;
return x;
}
int main (){
scanf ("%d",&n);
int i;
for (i=1;i<=n;i++)
scanf ("%d",&a[i]);
a[0]=a[n];
for (i=0;i<n;i++){
if (abs(a[i+1]-a[i])>mx)
mx=abs(a[i+1]-a[i]);
s+=a[i];
}
c1=ceil(s/(n/2));
printf ("%d",max(c1,mx)+1);
return 0;
}

哪错了???????

2 条评论

  • 1

信息

ID
1339
难度
5
分类
贪心 点击显示
标签
(无)
递交数
699
已通过
216
通过率
31%
被复制
4
上传者