2013 Fourth annual Blue Bridge Cup--gold even score Java

Source: Internet
Author: User

title: Gold even fractional golden divide number 0.61803... is an irrational number, this constant is very important and will arise in many engineering problems.    Sometimes it takes a lot of precision to figure this out. For some precision engineering, the precision of a constant is important. Perhaps you have heard of the Hubble Space Telescope, which has discovered a manual machining error on its first launch, and for a giant like that, it's just a mistake that makes it a lot thinner than the hair in the mirror, but it becomes "myopia" .!!So, how do we get the best possible value for the Golden segment number?    There are many ways. A relatively simple one is to use a hyphen:1Gold Number= ---------------------1             1+ -----------------1                 1+ -------------1                     1+ ---------1+ ...    The greater the number of "layers" that the even fraction calculates, the closer the value is to the Golden segment.    Take advantage of this feature to find enough accurate values for the golden segment to be rounded up to 100 decimal places. The 3-bit value after the decimal point is:0.618the 4-bit value after the decimal point is:0.6180the 5-bit value after the decimal point is:0.61803the 7-bit value after the decimal point is:0.6180340(note the tail of the 0, cannot be ignored) your task is: write the accurate to the decimal point after the 100-bit precision of the Golden Section value. Note: The mantissa is rounded! The mantissa is 0 also to keep! Obviously the answer is a decimal number, which has 100 digits after the decimal point, please submit the number directly through the browser. Note: Do not submit the content of the answer process, or other auxiliary description classes. 

Write this problem without train of thought, check a lot of information, finally understand. The following from the network of the great gods, thank you!

//with Fibonacci sequence and analog hand division
//The golden divide is actually the quotient of two Fibonacci numbers adjacent to each other .ImportJava.math.BigInteger; Public classMain { Public Static voidMain (string[] args) {BigInteger firstnum= Biginteger.one;//1BigInteger Secnum =Biginteger.one; BigInteger Res= Biginteger.zero;//0BigInteger TEN = Biginteger.ten;//Ten//The Fibonacci sequence of the BigInteger for(inti = 0; I < 50000; i++) { if(i = = 0 | | i = = 1) {res=Biginteger.one; } Res= Secnum.add (Firstnum);//two x BigInteger addedFirstnum =Secnum; Secnum=Res; } //the For Loop implements analog hand Division for(inti = 0; I < 101; i++) { //Choose Fibonacci Two consecutive numbers, small do dividend, big do divisor//each one is the quotient of the twoBigInteger ans =firstnum.divide (Secnum); //divisor constant, divisor = remainder *10Firstnum =(Firstnum.mod (secnum)). Multiply (TEN); if(i!=0) {//output only the following 100 decimal placesSystem.out.print (ans); }} System.out.println (); }}

Ans

6180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911374

2013 Fourth annual Blue Bridge Cup--gold even score Java

Related Article

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.