uva 10283 The Kissing Circles

原题:
There are some interesting figures below. You can see that we can put within a circle one or more circles of equal radius. The important property of these circles is 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 will have 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 will 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 have ten digits after the decimal
point. The output will be checked with special correction programs. So you wont have 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

中文:
给你一个大圆的半径,然后再给你小圆的个数。问你按照如图的方式摆放后小圆的半径是多少,小圆所包围的中间区域面积是多少,在大圆中,除去小圆面积和中间的面积后剩下多少?

#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(10)<<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(10)<<r<<" "<<cen<<" "<<Area-area-cen<<endl;
    }
    return 0;
}

解答:

高中题目,利用大圆半径和角度关系就能得到小圆半径,剩下的以此算出即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值