/*
贪心的找到相邻两项差的最大值,再减去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");
}
}
相关文章
- Codeforces Round #272 (Div. 2)-A. Dreamoon and Stairs
- Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs 水题
- Codeforces Round #257 (Div. 2) A. Jzzhu and Children(简单题)
- Codeforces Round #520 (Div. 2) A. A Prank 好题
- Codeforces Round #455 (Div. 2) A. Generate Login【贪心】
- codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)
- Codeforces Round #604 (Div. 2) A. Beautiful String
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题