Uva-1646-edge Case (law)

Source: Internet
Author: User

Test instructions: N (3 <= n <= 10000) nodes form a circle to find the number of matches (that is, a set of edges without a common point).

Find the law for the nature of Fibonacci, because the number is too large to use the large number of java.

ImportJava.math.BigInteger;ImportJava.util.Scanner; Public classmain{ Public Static intMAXN = 10000 + 10;  Public StaticBigInteger []c =NewBIGINTEGER[MAXN];  Public Static voidinit () {c[3] =NewBigInteger ("4"); c[4] =NewBigInteger ("7");  for(inti = 5; i < MAXN; ++i) c[i]= C[i-1].add (c[i-2]); }     Public Static voidMain (String []args) {init (); Scanner SC=NewScanner (system.in);  while(Sc.hasnextint ()) {intn =Sc.nextint ();        System.out.println (C[n]); }    }}

Uva-1646-edge Case (law)

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.