Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created April 9, 2023 18:51
Show Gist options
  • Save estelabn/6db64e5c706c55bebf001bec8d51d7c6 to your computer and use it in GitHub Desktop.
Save estelabn/6db64e5c706c55bebf001bec8d51d7c6 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,d;
cin >> n >> a >> d;
int res = 0;
for(int i=0; i<n; i++){
int m; cin >> m;
int difAtual = abs(m - a);
if(difAtual <= d) res++;
}
cout << res << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment