/*
贪心的找到相邻两项差的最大值,再减去c,结果若是负数答案为0.
*/
1 #include <stdio.h>
#define maxn 105
int num[maxn];
int main()
{
int n,c;
while(~scanf("%d%d",&n,&c))
{
int ans = ;
for(int i = ;i < n;i++)
scanf("%d",num+i);
for(int i = ;i < n-;i++){
int temp = num[i] - num[i+];
if(temp > ans)
ans = temp;
}
ans -= c;
if(ans>=)
printf("%d\n",ans);
else
printf("0\n");
}
}
相关文章
- Educational Codeforces Round 78 (Rated for Div. 2) A. Shuffle Hashing
- Codeforces Round #248 (Div. 2) A. Kitahara Haruki's Gift
- Codeforces Round #497 (Div. 2) A. Romaji
- Codeforces Round #325 (Div. 2) A. Alena's Schedule 水题
- Codeforces Round #192 (Div. 2) (330A) A. Cakeminator
- Codeforces Round #328 (Div. 2)_A. PawnChess
- Codeforces Round #235 (Div. 2) A. Vanya and Cards
- Codeforces Round #525 (Div. 2)A. Ehab and another construction problem
- Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs 水题
- Codeforces Round #272 (Div. 2)-A. Dreamoon and Stairs