import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=1;i<=n;++i){
if(Four(i)) continue;
if(i%4==0) continue;
System.out.println(i);
}
}
public static boolean Four(int n){
while(n>0){
if(n%10==4){
return true;
}
n/=10;
}
return false;
}
}
只需暴力枚举即可

京公网安备 11010502036488号