UVA 10283 The Kissing Circles

Source: Internet
Author: User
Tags sin


Original title:
There is some interesting figures below. You can see the we can put within a circle one or more circles of equal radius. The important property of these circles are that every consecutive circles touch each other. Given the radius R of the larger circle and the number of small circles N of equal radius inside,you'll has to find the Radius of the smaller circles R, the area surrounded by the kissing small circles (light blue) I and the area outside the Kissing small circles but inside the larger circle (light green) E.



Input
The input file is contain several lines of inputs. Each line contains non-negative integers R (r≤
10000) and N (1≤n≤100) as described before. Input is terminated by end of file.
Output
For each line of input produce one line of output. This one, line contains three floating point numbers
R, I and E as described before. The floating point numbers should has ten digits after the decimal
Point. The output would be checked with special correction programs. So you wont has to worry about
Small precision errors.
Sample Input
10 3
10 4
10 5
10 6



Sample Output



4.6410161514 3.4732652470 107.6854162259
4.1421356237 14.7279416563 83.8264899217
3.7019190816 29.7315551092 69.1625632742
3.3333333333 45.6568837582 59.0628713615



English:
Give you a circle radius, and then give you the number of small circle. Ask you how much the radius of the small circle is placed in the way of the figure, the area of the middle area surrounded by the small circle, and how much is left in the large circle, excluding the area of the small circle and the area of the middle.


#include <bits/stdc++.h>
using namespace std;
Double R;
Double N;
int main ()
{
    Ios::sync_with_stdio (false);
    Double Pi=acos ( -1.0);
    while (Cin>>r>>n)
    {
        if (n==1)
        {
            cout<<fixed<<setprecision (Ten) <<r << "<<0.0<<" <<0.0<<endl;
            Continue;
        }
        Double area=pi*r*r;
        Double R=r*sin (pi/n)/(Sin (pi/n) +1);
        Double area=pi*r*r*n;
        Double cen= (N*r*r/tan (pi/n)-((n-2)/2) *pi*r*r);
        Cout<<fixed<<setprecision <<r<< "<<cen<<" <<Area-area-cen<< Endl;
    }
    return 0;
}


Answer:



High school topics, the use of large circle radius and angle of the relationship can be a small circle radius, the rest of this can be calculated.


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.