Codeforce Round #226 Div2 A
→ Practice
You are registered for practice. You can solve problems unofficially. Results can be found in the contest status and in the bottom of standings.
1 #pragma comment(linker,"/STACK:102400000,102400000") 2 #include <cstdio> 3 #include <vector> 4 #include <cmath> 5 #include <queue> 6 #include <cstring> 7 #include <iostream> 8 #include <algorithm> 9 using namespace std; 10 #define INF 0x7fffffff 11 #define mod 1000000007 12 #define ll long long 13 #define maxn 1000025 14 #define pi acos(-1.0) 15 int n, m; 16 int a[maxn]; 17 int main(){ 18 scanf("%d%d", &n, &m); 19 for (int i = 0; i < n; i++){ 20 scanf("%d", &a[i]); 21 } 22 int x = 0; 23 for (int i = 1; i < n; i++){ 24 x = max(x,a[i - 1] - a[i]); 25 } 26 printf("%d\n", max(0,x - m)); 27 return 0; 28 }




浙公网安备 33010602011771号