题目链接:Codeforces 385A Bear and Raspberry
#include <iostream>
#include <cstdio>
using namespace std;
const int MAX_N = 100 + 10;
int main()
{
int arr[MAX_N], n, c;
scanf("%d%d", &n, &c);
for(int i = 0; i < n; i++)
scanf("%d", &arr[i]);
int _max;
_max = arr[0] - arr[1] - c;
for(int i = 1; i < n - 1; i++)
_max = max(arr[i] - arr[i + 1] - c, _max);
if(_max < 0)
_max = 0;
printf("%d\n", _max);
return 0;
}