解题思路:
注意事项: 利用对数函数(Math.log10()+1 )求数m的位数
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int m = scanner.nextInt();
int k = scanner.nextInt();
double shu = 1+Math.log10(m);
int n = 0;
if(m%19==0){
for(int i=1;i<shu;i++){
int num = m%10;
m = m/10;
if(num==3){
n+=1;
}
}
if(n==3){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
else{
System.out.println("NO");
}
}
}
}
0.0分
0 人评分