签到题

签到题

时间限制: 1000 ms  |  内存限制: 65535 KB
难度: 2
描述

hrw最近看到一个有趣的几何题,题目描述是这样的:一个大圆盘里面放入许多小圆,每个小圆必须接触大圆边缘且与其他小圆不能相交,但它们可以互相接触,每个小圆具有相同的半径,求此条件下能否放入n个小圆盘。

输入
Multiple sets of test data,The first line contains three integers n, R and r (1 ≤ n ≤ 100, 1 ≤ r, R ≤ 1000) — the number of plates, the radius of the table and the plates' radius.and you can think the pi is 3.1415927
输出
Print "YES" (without the quotes) if it is possible to place n plates on the table by the rules given above. If it is impossible, print "NO".Remember, that each plate must touch the edge of the table.
样例输入
4 10 4
2 10 10
样例输出
YES
NO
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int n,a,b;
    while(scanf("%d%d%d",&n,&a,&b)!=-1)
    {
        if(n<=2)
        {
            if(n*b<=a)
            {
                printf("YES\n");
            }
            else
            {
                printf("NO\n");
            }
        }
        else
        {
        double we,ni;
        we=asin((b*1.0)/(a-b));//这里求出的是实际度数和最大预计度数 
        ni=3.1415927/n;
        if(ni>=we)
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
        }
    }
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值