Package COM. WZS; // a vampire number refers to a number with an even number. It can be obtained by multiplying a pair of values and a value ending with two zeros is not allowed. // For example: 1260 = 21*60 1827 = 21*87 2187 = 27*81 public class test {public static void main (string [] ARGs) {for (INT I = 1000; I <9999; I ++) {isbloodsucker (I, COM (a (I), B (I), COM (C (I), D (I ))); isbloodsucker (I, COM (a (I), B (I), COM (d (I), C (I); isbloodsucker (I, COM (a (I), C (I), COM (B (I), D (I); isbloodsucker (I, COM (a (I ), C (I), COM (d (I), B (I); isbloodsucker (I, COM (a (I), D (I )), COM (B (I), C (I); isbloodsucker (I, COM (a (I), D (I), COM (C (I ), B (I); isbloodsucker (I, COM (B (I), A (I), COM (C (I), D (I ))); isbloodsucker (I, COM (B (I), A (I), COM (d (I), C (I); isbloodsucker (I, COM (B (I), C (I), COM (d (I), A (I); isbloodsucker (I, COM (B (I ), d (I), COM (C (I), A (I); isbloodsucker (I, COM (C (I), A (I )), COM (d (I), B (I); isbloodsucker (I, COM (C (I), B (I), COM (d (I ), A (I) ;}}// determine whether the vampire number is static void isbloodsucker (int I, int M, int N) {if (I = m * n) {system. out. println (I + "=" + M + "*" + n) ;}// combine them into two-digit static int COM (int I, Int J) {return (I * 10) + J;} // thousands of static int A (int I) {return I/1000;} // hundreds of static int B (int I) {return (I % 1000)/100;} // ten static int C (int I) {return (I % 1000) % 100)/10 ;} // single-digit static int D (int I) {return (I % 1000) % 100) % 10 ;}}
Output result:
1260 = 21*601395 = 15*931435 = 41*351530 = 51*301827 = 87*212187 = 27*816880 = 86*806880 = 80*86