---- 点我 ---- 题目大意:

给你一个正n边形及边长 a和一个正整数L,

求正多边形的面积s,若s大于L,则连接相邻两边的中点,形成新的正多边形,重复这个操作直至s小于L:如图:

正多边形的面积 : S = n*a^*a / (4tan(α/2);

n 为边数, a为当前边长,α为圆心角;

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long lint;
const double PI = acos(-1.0);
const int INF = ;
const int maxn = ;
double a, n, S, sn, c; void st(double a) //求面积
{
sn = n * a * a / / tan(c/);
} int main()
{
int T;
cin >> T;
while(T--)
{
int cnt = ;
cin >> n >> a >> S;
c = / n / * PI; // 圆心角的弧度值
double b = * (n-) * PI / n / ; // 正多边形的每个角的弧度
sn = n * a * a / / tan(c/); //初始面积
// cout << sn << endl;
while(sn >= S)
{
a *= sin(b/); // 操作后的边长与原边长的关系;
st(a); // 更新面积
cnt++; // 操作次数加加
} cout << cnt << endl;
} return ;
}

Thinking-Bear magic (计算几何)的更多相关文章

  1. 湖南程序设计竞赛赛题总结 XTU 1237 Magic Triangle(计算几何)

    这个月月初我们一行三人去湖南参加了ccpc湖南程序设计比赛,虽然路途遥远,六月的湘潭天气燥热,不过在一起的努力之下,拿到了一块铜牌,也算没空手而归啦.不过通过比赛,还是发现我们的差距,希望这几个月自己 ...

  2. 【计算几何】【状压dp】Codeforces Round #226 (Div. 2) D. Bear and Floodlight

    读懂题意发现是傻逼状压. 只要会向量旋转,以及直线求交点坐标就行了.(验证了我这俩板子都没毛病) 细节蛮多. #include<cstdio> #include<algorithm& ...

  3. Magic Line(思维+计算几何问题)(2019牛客暑期多校训练营(第三场))

    示例: 输入: 140 1-1 01 00 -1 输出:-1 999000000 1 -999000001 题意:给定平面上一系列的点,求一条以(x1,y1),(x2,y2)两点表示的直线将平面分为包 ...

  4. 2019牛客暑期多校训练营(第三场)- H Magic Line (计算几何)

    题目链接:https://ac.nowcoder.com/acm/contest/883/H 题意:给定n个点(n为偶数),求一条直线使得n个点平均分散在直线两端,即每端n/2个点. 思路:把n个点按 ...

  5. ACM计算几何题目推荐

    //第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面 ...

  6. poj 1696:Space Ant(计算几何,凸包变种,极角排序)

    Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2876   Accepted: 1839 Descrip ...

  7. ACM/ICPC 之 计算几何入门-叉积-to left test(POJ2318-POJ2398)

    POJ2318 本题需要运用to left test不断判断点处于哪个分区,并统计分区的点个数(保证点不在边界和界外),用来做叉积入门题很合适 //计算几何-叉积入门题 //Time:157Ms Me ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 内核atom机制

    内核版本:linux2.6.22.6 硬件平台:JZ2440 驱动源码 atom_ipc_poll_key_int_drv.c : #include <linux/module.h> #i ...

  2. 获取连接的用户ip

    public static string GetUserIP() { string result = String.Empty; result = HttpContext.Current.Reques ...

  3. cuda9.0编译caffe报错nvcc fatal : Unsupported gpu architecture 'compute_70'

    Tesla V100 cuda9.0 caffe编译的时候报上述错误,修改方法: CUDA_ARCH := #-gencode arch=compute_20,code=sm_20 \ #-genco ...

  4. 前端 HTML form表单标签 input标签 type属性 radio 单选框

    <input type="radio"> 单选框 适用于 选择性别按钮网页等 <!DOCTYPE html> <html lang="en& ...

  5. 数据库——MongoDB

    what's the MongoDB MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的.他支持的数据结构非常松散,是类似json的bson格式 ...

  6. Delphi INI文件保存与读取

    //需要引用IniFiles uses system.IniFiles; //保存INI配置文件 procedure TForm1.btnSaveClick(Sender: TObject); var ...

  7. shell编程awk进阶

    awk操作符 算术操作符:  x+y, x-y, x*y, x/y, x^y, x%y      -x: 转换为负数      +x: 转换为数值 字符串操作符:没有符号的操作符,字符串连接 赋值操作 ...

  8. ABP-添加表

    1.在My_ABP.Core根目录下先创建一个文件夹,在该文件夹里创建一个公共的类,在里面定义所需要用到的属性 public class Person:Entity      {         pu ...

  9. IconMoon图标字体制作

    官网:https://icomoon.io/ 点击右上角“IconMoon APP” 点击左上角“import Icons”按钮 选中小图标 - 选择右下角“Generate Font”生成图标字体 ...

  10. OpenShift Origin 基本命令

    用户管理 $ oc login #登陆$ oc logout #注销$ oc login -u system:admin -n default #以系统管理身份登陆并指定项目$ oc login ht ...