-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboj_1065.java
More file actions
38 lines (28 loc) · 813 Bytes
/
boj_1065.java
File metadata and controls
38 lines (28 loc) · 813 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
38
package brute_force;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class boj_1065 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
System.out.println(NumberCount(N));
}
private static int NumberCount(int N) {
int cnt = 0;
if(N<100) {
return N;
} else {
cnt = 99;
for(int i=100; i<=N; i++) {
int A = i / 100;
int B = (i / 10) % 10;
int C = i % 10;
if(B-A == C-B) {
cnt++;
}
}
}
return cnt;
}
}