The main contents of the first lesson:
Brute force and practicality first (1) The importance of brute force in competition and enterprise Application (2) Practical principles in Brute force ( 3) Inverse solution (4) enumeration method
Topic One:
American mathematician Wiener (N.wiener) had a precocious intellect and went to college at the age of 11.
He was invited to lecture at Tsinghua University in China for 1935-1936 years. Once, he attended an important meeting, and the young faces were striking. Then someone asked him about his age, and he replied, "My age Cube is a 4-digit number." My 4-time-old is a 6-digit number. These 10 numbers just happen to contain 10 numbers from 0 to 9, each of which happens 1 times at a time. "Please calculate how young he was at that time."
Problem Solving methods:
1 PackageCom.algorithm.java.blueBirdge;2 3 //import static sun.misc.Version.println;4 5 Public classTESTSUANFA {6 Public Static voidMain (string[] args) {7 //assuming his age is between 1 and 100 years (40)8 for(inti=10;i<100;i++){9 //four-time judgment on the age of the cubic and the ageTen intA =i*i*i; One intb=a*i; A //turn A into a string - if(A + ""). Length ()!=4)Continue;//If you convert a from a number to a string, the length is not 4, jump out of the loop - if(b + ""). Length ()!=6)Continue;//If the B is converted from a number to a string, the length is not 6, jumping out of the loop theSYSTEM.OUT.PRINTLN (i + "four times is" +a+ "of the six-time side is" +b); - } - } - +}
Test results:
Results can be seen: 18
Write the program requirements: practical, fast, stable, effective!
java--Algorithm Special training (1) brute force and practicality first