Java programming to find the age

Source: Internet
Author: User

Title: My Age Cube is a 4-digit number. My 4-time-old is a 6-digit number. These 10 numbers contain exactly 10 numbers from 0 to 9, each of which happens 1 times to find out how old I am this year.

Direct copy operation is possible.

 Public classAge { Public Static voidMain (string[] args) {//TODO auto-generated Method StubAge A =NewAge ();    A.fun (); }        Private intFun () { for(inti = 0;i<60;i++){            if((i*i*i)/1000>0 && (i*i*i*i)/100000>0) {String A1= (i*i*i) + ""; String A2= (i*i*i*i) + ""; string[] Str= (A1+A2). Split (""); if(Panduan (str)) {SYSTEM.OUT.PRINTLN ("This 10-digit number is" + (a1+A2));                    System.out.println (i); return1; }            }        }        return-1; }        Private BooleanPanduan (string[] str) { for(inti = 0;i<10;i++){             for(intj = i+1;j<10;j++){                if(Str[i] = =Str[j]) {                    return false; }            }        }        return true; }}

The output is:

This 10-digit number is 5832104976.
18

--------------------------------

The final answer is 18 years old.

Java programming to find the age

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.