Arbor Day skillfully guessing birthday problem

Source: Internet
Author: User

This year's Arbor Day (March 12, 2012), Xiao Ming and his uncle and his small friends to plant trees together.
Rest, Xiao Ming's classmate asked his uncle how old, his uncle said: "I said a topic, see you who first guess!" ”
"The day I was born together to spell a 8-digit number (month, day less than two before 0) just can be today's year, month, day evenly divisible! ”
He thought, adding: "Give another hint, I was born in June." ”
According to this information, please help Xiao Ming to calculate his uncle's date of birth.
The answer is written in the "answer. txt", do not write here!
The format is a 8-digit number that is connected by day and month.

For example, if it is June 12, 1948, write: 19480612

Package Bluebriage;public class Planttreesguessbirthday {public static void main (string[] args) {new Planttreesguessbirthday (). Run ();} public void Run () {int n=20120312; String s= ""; for (int i=19000601;i<=n;i++) {s= "" +i;//convert I to string int day=integer.parseint (s.substring (6));//day int Month =integer.parseint (s.substring (4,6));//month if (day>=1&&day<=31&&month>=1&&month <=12&&i%2012==0&&i%12==0) {System.out.println (i);}}}}

19200516
19520424
19550604
19870512

Arbor Day skillfully guessing birthday problem

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.