思路:
String.valueOf(int i) : 将 int 变量 i 转换成字符串
String.contains()用于判断字符串是否包含子字符串
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[4];
for(int i = 0; i < n; i++) {
if((i+1) % 7 == 0 || String.valueOf(i+1).contains("7")) {
a[i%4] ++;
n++;
}
}
sc.close();
for(int i = 0; i < 4; i++) {
System.out.println(a[i]);
}
}
}