알고리즘왕/BOJ
[백준/1065/JAVA] 한수
찌 ㅋ
2020. 3. 18. 00:29

import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
for(int i = 1; i<=n; i++) {
if(solution(i))
count++;
}
System.out.println(count);
}
static boolean solution(int n) {
boolean result = false;
if(n<100)
result = true;
else if(n<1000) {
int h = n/100;
int t = n%100/10;
int o = n%10;
if (h-t == t-o)
result=true;
}
return result;
}
}