/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君は学校の先生から、テストの採点結果を集計する仕事を頼まれました。
このテストでは、基準点 S 点と許容差 T 点が設定されています。生徒の点数 A_i と基準点 S の差の絶対値が T 以下、すなわち |A_i - S| \leq T であれば、その生徒は「合格」と判定されます。
N 人の生徒がテストを受け、i 番目の生徒 (1 \leq i \leq N) の点数は A_i 点でした。
合格した生徒の人数を求めてください。
制約
- 1 \leq N \leq 2 \times 10^5
- 0 \leq S \leq 100
- 0 \leq T \leq 100
- 0 \leq A_i \leq 100 (1 \leq i \leq N)
- 入力はすべて整数
入力
N S T A_1 A_2 \ldots A_N
- 1 行目には、生徒の人数を表す N 、基準点を表す S 、許容差を表す T が、スペース区切りで与えられる。
- 2 行目には、各生徒の点数を表す A_1, A_2, \ldots, A_N が、スペース区切りで与えられる。
- A_i は i 番目の生徒の点数を表す。
出力
合格した生徒の人数を 1 行で出力せよ。
入力例 1
5 60 10 55 70 62 45 58
出力例 1
4
入力例 2
8 75 5 80 75 70 68 82 74 76 90
出力例 2
5
入力例 3
15 50 0 50 49 51 50 48 52 50 50 47 53 50 46 54 50 55
出力例 3
6
Score : 200 pts
Problem Statement
Takahashi has been asked by his school teacher to compile the grading results of a test.
For this test, a reference score of S points and a tolerance of T points are set. If the absolute difference between a student's score A_i and the reference score S is at most T, that is, if |A_i - S| \leq T, then the student is judged as "passing."
N students took the test, and the score of the i-th student (1 \leq i \leq N) was A_i points.
Find the number of students who passed.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 0 \leq S \leq 100
- 0 \leq T \leq 100
- 0 \leq A_i \leq 100 (1 \leq i \leq N)
- All inputs are integers
Input
N S T A_1 A_2 \ldots A_N
- The first line contains N representing the number of students, S representing the reference score, and T representing the tolerance, separated by spaces.
- The second line contains A_1, A_2, \ldots, A_N representing each student's score, separated by spaces.
- A_i represents the score of the i-th student.
Output
Print the number of students who passed in one line.
Sample Input 1
5 60 10 55 70 62 45 58
Sample Output 1
4
Sample Input 2
8 75 5 80 75 70 68 82 74 76 90
Sample Output 2
5
Sample Input 3
15 50 0 50 49 51 50 48 52 50 50 47 53 50 46 54 50 55
Sample Output 3
6