-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathp16162.java
More file actions
37 lines (35 loc) · 992 Bytes
/
p16162.java
File metadata and controls
37 lines (35 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* BOJ 16162 가희와 3단고음
* 그리디
*/
import java.io.*;
import java.util.*;
public class p16162 {
static int n, a, d;
static int[] arr;
public static void main(String[] args) throws IOException {
init();
pro();
}
static void init() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
a = Integer.parseInt(st.nextToken());
d = Integer.parseInt(st.nextToken());
arr = new int[n];
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; i++) {
arr[i] = Integer.parseInt(st.nextToken());
}
}
static void pro() {
int step = 0;
for (int i = 0; i < n; i++) {
if (arr[i] != a) continue;
step++;
a += d;
}
System.out.println(step);
}
}