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

这个月月初我们一行三人去湖南参加了ccpc湖南程序设计比赛,虽然路途遥远,六月的湘潭天气燥热,不过在一起的努力之下,拿到了一块铜牌,也算没空手而归啦.不过通过比赛,还是发现我们的差距,希望这几个月自己努力思考,积极刷题,为九月份acm网络赛做准备! 言归正传说说这道题目,这也是这次比赛想到AC比较高的题目,不过我们还是没能完成,下面我就来总结一下此题的一些思路和方法. Magic Triangle Problem Description: Huangriq is a respectful acm…
---- 点我 ---- 题目大意: 给你一个正n边形及边长 a和一个正整数L, 求正多边形的面积s,若s大于L,则连接相邻两边的中点,形成新的正多边形,重复这个操作直至s小于L:如图: 正多边形的面积 : S = n*a^*a / (4tan(α/2): n 为边数, a为当前边长,α为圆心角: #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #includ…
读懂题意发现是傻逼状压. 只要会向量旋转,以及直线求交点坐标就行了.(验证了我这俩板子都没毛病) 细节蛮多. #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; const double PI=acos(-1.0); #define EPS 0.00000001 struct Point { double x,y; Point(…
示例: 输入: 140 1-1 01 00 -1 输出:-1 999000000 1 -999000001 题意:给定平面上一系列的点,求一条以(x1,y1),(x2,y2)两点表示的直线将平面分为包含点数量相等的两部分,其中直线不能穿过任何一点. 思路: #include<bits/stdc++.h> using namespace std; struct node { int x,y; }; bool cmp(node p,node q) { if(p.x==q.x)return p.y&…
题目链接:https://ac.nowcoder.com/acm/contest/883/H 题意:给定n个点(n为偶数),求一条直线使得n个点平均分散在直线两端,即每端n/2个点. 思路:把n个点按x升序排列,x相等时按y升序排列,这时候我们取第n/2个点和第n/2+1个点,以它两为界限,把n个点均分.因为n个点的坐标<=1e3,而我们的直线的点可以<=1e9,那么一定可以找到一条很陡的直线满足条件. 图片来自:https://www.cnblogs.com/st1vdy/p/1124593…
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板.如果代码一片混乱,那么会严重影响做题正确率. 4.注意精度控制. 5.能用整数的地方尽量用整数,要想到扩大数据的方法(扩大一倍,或扩大sqrt2).因为整数不用考虑浮点误差,而且运算比浮点快. 一.点,线,面,形基本关系,点积叉积的理解 POJ 2318 TOYS(推荐) http:/…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2876   Accepted: 1839 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y19…
POJ2318 本题需要运用to left test不断判断点处于哪个分区,并统计分区的点个数(保证点不在边界和界外),用来做叉积入门题很合适 //计算几何-叉积入门题 //Time:157Ms Memory:828K #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; #define MAXN 5005 struct P…
F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak is a grizzly bear. He is big and dreadful. You were chilling in the forest when you suddenly met him. It's very u…
D. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of…