泠风风风风风 edited 9 月,3 周前
#include<stdio.h>
int main() {
int n, x, t, a;
int ans = 0, count = 0;
scanf("%d%d%d", &n, &x, &t);
while (n--) {
scanf("%d", &a);
int m = a % x;
if (m <= t || m >= x - t) {
count++;
} else {
ans = count > ans ? count : ans;
count = 0;
}
}
ans = count > ans ? count : ans;
printf("%d\n", ans);
return 0;
}