穷举所有类型

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            System.out.println(findSeven(a));
        }
    }
    public static int findSeven(int a) {
        int result = 0;
        if (a < 7) {
            return result;
        }
        for (int i = 7; i <= a; i++) {
            if (isSeven(i)) {
                result = result + 1;
            }
        }
        return result;
    }
    public static boolean isSeven(int number) {
        boolean result = false;
        if (number % 7 == 0) {
            return true;
        } else {
            int count = number;
            while (count > 0) {
                if (count % 10 == 7) {
                    return true;
                }
                count = count / 10;
            }
        }
        return result;
    }
}