Question description
This question is a fill-in-the-blank question. You only need to calculate the result and use the output statement in the code to output the filled-in result.
There is a 6-digit positive integer, which has a very magical property:
Multiply it by 2, 3, 4, 5, and 6 respectively, and the result is still a 6-digit number, and the number contained in the product is exactly the same as this 6-digit number! It's just that their order has been rearranged.
Please calculate this 6-digit number.
operating restrictions
- Maximum running time: 1s
- Maximum running memory: 128M
import java.util.*;
public class Main {
public static void main(String[] args) {
int n=0;
for(int i=100000;i<1000000;i++){
n=i*2;
int count=0;
if(check(i,n)==1){
count++;
}
n=i*3;
if(check(i,n)==1){
count++;
}
n=i*4;
if(check(i,n)==1){
count++;
}
n=i*5;
if(check(i,n)==1){
count++;
}
n=i*6;
if(check(i,n)==1){
count++;
}
if(count==5){
System.out.println(i);
break;
}
}
}
public static int check(int i,int n){
int flag=0;
char[] ch=Integer.toString(i).toCharArray();
Arrays.sort(ch);
char[] ch1=Integer.toString(n).toCharArray();
Arrays.sort(ch1);
if(Arrays.equals(ch,ch1)){
flag=1;
}
return flag;
}
}