题解 | 牛牛数数
牛牛数数
https://www.nowcoder.com/practice/03a3cc96fa4847b387bf58bb800d67cf
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
for(int i=1;i<=n;i++)
{
if((Judgment(i))!=0&&i%4!=0)
{
System.out.println(i);
}
}
}
public static int Judgment(int s)
{
int h=1;
while(s!=0)
{
if(s%10==4)
h=0;
s/=10;
}
return h;
}
}
查看8道真题和解析