利用%7以及contains方法解题
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = Integer.parseInt(in.nextLine());
int count = 0;
for (int i = 1; i <= n; i++) {
if (String.valueOf(i).contains("7") || i % 7 == 0) {
count++;
}
}
System.out.println(count);
}