public class Main {
public static void main(String[] args) {
int count = 0, index = 0;
while (count < 2023) {
index++;
if (check(index, 2) && check(index, 8) && check(index, 10) && check(index, 16)) {
count++;
}
}
System.out.println(index);
}
static boolean check(int n, int x) {
int mod = 0;
//将n转化为x进制的字符串
String s = Integer.toString(n, x);
for (int i = s.length() - 1; i >= 0; i--) {
//截取字符串每一位,并且求和
mod += Integer.valueOf(String.valueOf(s.charAt(i)), x);
}
return n%mod==0;
}
}
0 回复
0 转发
0 喜欢
1 阅读



