题目描述

In order to become a magical girl, Thinking-Bear are learning magic circle.
He first drew a regular polygon of N sides, and the length of each side is a.
He want to get a regular polygon of N sides, and the polygon area is no more than L.
He doesn't want to draw a new regular polygon as it takes too much effort.
So he think a good idea, connect the midpoint of each edge and get a new regular polygon of N sides.
How many operations does it need to get the polygon he want?

输入描述:

The first line of the input is T(1≤ T ≤ 100), which stands for the number of test cases you need to solve.
The first line of each case contains three space-separated integers N, a and L (3 ≤ N ≤ 10, 1 ≤ a ≤ 100, 1 ≤ L ≤ 1000).

输出描述:

For each test case, output a single integer.

输入例子:
1
4 2 3
输出例子:
1

-->

示例1

输入

复制

1
4 2 3

输出

复制

1

思路:弱弱的推了一半天,在大佬的指点之下终于推出了公式;题意是讲若当前多边形的面积大于L就将每条边的中点依次连接构成一个新的多边形 求多少次这种操作之后面积S不大于L;首先已知多边形边长为a,外接圆半径R = a/(2*sin(pi/n)); 面积S = 0.5*n*R^2*sin((2*pi)/n);
  然后以此类推求出内接正多边形的边长与内接正多变形的外接圆半径r;内接正多变的边长x = a*cos(pi/n);emmmmm就以此类推下去了吧下面附上代码
 #include<iostream>
#include<cmath>
#define pi 3.141592653589793238462643383
using namespace std; int T,n;
double a,L;
int main()
{
ios::sync_with_stdio(false);
cin>>T;
while(T--){
cin>>n>>a>>L;
double R = a/(2.0*sin(pi/n));
double s = 0.5*n*R*R*sin((*pi)/n);
double r;int ans = ;
while(s>L){
ans++;
a = a*cos(pi/n);
r = a/(2.0*sin(pi/n));
s = 0.5*n*r*r*sin((*pi)/n);
}
cout<<ans<<endl;
}
return ;
}

D Thanking-Bear magic的更多相关文章

  1. Codeforces CF#628 Education 8 F. Bear and Fair Set

    F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  2. Codeforces CF#628 Education 8 D. Magic Numbers

    D. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  3. Codeforces CF#628 Education 8 C. Bear and String Distance

    C. Bear and String Distance time limit per test 1 second memory limit per test 256 megabytes input s ...

  4. [8.3] Magic Index

    A magic index in an array A[0...n-1] is defined to be an index such that A[i] = i. Given a sorted ar ...

  5. Python魔术方法-Magic Method

    介绍 在Python中,所有以"__"双下划线包起来的方法,都统称为"Magic Method",例如类的初始化方法 __init__ ,Python中所有的魔 ...

  6. 【Codeforces717F】Heroes of Making Magic III 线段树 + 找规律

    F. Heroes of Making Magic III time limit per test:3 seconds memory limit per test:256 megabytes inpu ...

  7. 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

    Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...

  8. 一个快速double转int的方法(利用magic number)

    代码: int i = *reinterpret_cast<int*>(&(d += 6755399441055744.0)); 知识点: 1.reinterpret_cast&l ...

  9. Saddest's polar bear Pizza offered new YorkShire home

    Saddest:adj,可悲的,悲哀的,polar,两级的,极地额,YorkShire,约克郡 A UK wildlife park has confirmed that it is offering ...

  10. MAGIC XPA最新版本Magic xpa 2.4c Release Notes

    New Features, Feature Enhancements and Behavior ChangesSubforms – Behavior Change for Unsupported Ta ...

随机推荐

  1. NodeJs的简介及安装

    首先 分享一下NodeJs的应用场景吧: Web聊天室(IM):Express + Socket.io socket.io一个是基于Nodejs架构体系的,支持websocket的协议用于时时通信的一 ...

  2. Vagrant-安装教程及常见问题

    http://ju.outofmemory.cn/entry/346215 前言: Vagrant是一个基于Ruby的工具,用于创建和部署虚拟化开发环境. 它的主要意义是让所有开发人员都使用和线上服务 ...

  3. <> 是不等号的意思

    <> 是不等号的意思,也有的语言可以写作:#  或者 != 1.=表示 等于: 2.<> 表示不等于:(注释:在 SQL 的一些版本中,该操作符可被写成 !=): 3.> ...

  4. python 缓冲区 subprocess 黏包 黏包解决方案

    一.缓冲区 二.两种黏包现象 两种黏包现象: 1 连续的小包可能会被优化算法给组合到一起进行发送 黏包现象1客户端 import socket BUFSIZE = 1024 ip_prort = (' ...

  5. MySQL整数类型字段的长度总结

    MySQL还支持选择在该类型关键字后面的括号内指定整数值的显示宽度(例如,INT(4)). 该可选显示宽度规定用于显示宽度小于指定的列宽度的值时从左侧填满宽度.(类似使用LPAD函数效果) 在INT( ...

  6. MaxCompute SQL 使用正则表达式选列

    编辑MaxCompute SQL 时,经常会需要在某个表N个列中指定一些列.若需要指定的列比较少,编写SQL时一个个输入既可.当遇到列多的时候,一个个输入就会非常费劲.本文将介绍如何在编写MaxCom ...

  7. SVN过滤设置 标签: svn 2015-07-29 17:39 953人阅读 评论(35) 收藏

    为了方便管理我们的系统版本,很多人会用到SVN,开发中我们经常用到SVN插件, 但是对于某些文件的缓存来说, 我们只要有操作缓存便会保存一次, 每次提交很是麻烦, 可能有的文件或者文件夹我们并不想提交 ...

  8. qt 在ui界面添加控件后在cpp文件中无法调用?

    问题:qt 在ui界面添加控件后在cpp文件中无法调用? 解决方法:在build选项中选择“重新build项目”,再次在cpp中调用添加的控件发现可以调用了. 还有一种情况导致添加控件后无法调用,就是 ...

  9. Vue.js 第3章 axios&Vue过渡动画

    promise 它将我们从回调地狱中解脱出来 创建和使用 var fs = require('fs') // 创建promise // reslove表示执行成功后调用的回调函数 // reject表 ...

  10. 模板—插头dp(Ural 1519 Formula 1)

    括号表示法: 据说比下一个要快而且灵活. #include<iostream> #include<cstring> #include<cstdio> #define ...