Circle (Codevs 3134)

Source: Internet
Author: User

Title Description Description

On a circle, there are 2*k of different nodes, we use these points as the endpoints, even the K-line segments, so that each node is exactly one time. Please calculate how many lines are available to satisfy these segments by dividing the circle into the least part

Enter a description Input Description

One row only, an integer K (1<=k<=30)

Output description Output Description

Two spaces separated by a space, the latter is a minimum of a few pieces of the circle, the former is the number of programs connected under this premise

Sample input Sample Input

2

Sample output Sample Output

2 3

/*for any point on the circle A, can and any points of connection will be divided into two halves, the premise is that the number of points on both sides of the circle is even, then the circle is divided into the same way on both sides, known as Cattleya*/#include<cstdio>#include<iostream>#defineM 35using namespacestd;Long LongCa[m];intMain () {intN; scanf ("%d",&N); ca[0]=1;  for(intI=1; i<=n;i++) Ca[i]=(4*i-2) *ca[i-1]/(i+1); printf ("%lld%d", ca[n],n+1); return 0;}
View Code

Circle (Codevs 3134)

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.