题解 | #3和5#
3和5
https://ac.nowcoder.com/acm/problem/22189
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for(int i = 1; i <= n; i++){
int num = i;
if(num % 3 == 0){
while(num != 0){
if(num % 10 == 5){
System.out.println(i);
break;//不加如果该数数位上有多个5会多次打印
}
num /= 10;
}
}
}
}
}