http://acm.hdu.edu.cn/showproblem.php?pid=1700 Points on Cycle Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1567    Accepted Submission(s): 570 Problem Description There is a cycle with its c…
http://acm.hdu.edu.cn/showproblem.php?pid=1700 题目大意: 二维平面,一个圆的圆心在原点上.给定圆上的一点A,求另外两点B,C,B.C在圆上,并且三角形ABC的周长是最长的. 解题思路: 我记得小学的时候给出个一个定理,在园里面正多边形的的周长是最长的,这个定理我不会证明. 所以这里是三角形,当三角形为正三角形的时候,周长是最长的. 因为圆心在原点,所以我就向量(x,y)绕原点逆时针旋转120度和顺时针旋转120度.给定的点A可以看成(x,y)向量.…
题目链接:HDU 1700 Problem Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other you may assume that the radius…
题目链接 水题,卡了下下精度. #include <cstdio> #include <iostream> #include <cmath> using namespace std ; #define PI acos(-1.0) #define eps 1e-8 int judge(double x,double y) { double a; a = x-y; ) a = -a; if(a < eps) ; else ; } int main() { double…
已知圆心(0,0)圆周上的一点,求圆周上另外两点使得三点构成等边三角形. 懒得推公式,直接用模板2圆(r1=dist,r2=sqrt(3)*dist)相交水过 #include<cstdio> #include<iostream> #include<cmath> #include<algorithm> #include<iterator> using namespace std; #define eps 1e-6 typedef long lon…
题目传送门 题意:告诉若干个矩形的信息,问他们在凸多边形中所占的面积比例 分析:训练指南P272,矩形面积长*宽,只要计算出所有的点,用凸包后再求多边形面积.已知矩形的中心,向量在原点参考点再旋转,角度要转换成弧度制. /************************************************ * Author :Running_Time * Created Time :2015/11/10 星期二 10:34:43 * File Name :UVA_10652.cpp…
Points on Cycle Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1303    Accepted Submission(s): 459 Problem Description There is a cycle with its center on the origin. Now give you a point on t…
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=1700 题目: Points on Cycle Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2523    Accepted Submission(s): 972 Problem Description There is a cyc…
Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other you may assume that the radius of the cycle will not…
这题的俩种方法都是看别人的代码,方法可以学习学习,要多看看.. 几何题用到向量.. Points on Cycle Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1294    Accepted Submission(s): 455 Problem Description There is a cycle with its cente…
                                            Points on Cycle Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find ou…
Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia…
题目大意:n个向量首尾相连,每次操作使某个区间中的所有向量都旋转同样的角度.每次操作后都回答最后一个向量的坐标. 题目分析:区间维护向量信息.向量旋转:x1=x0*cos(t)-y0*sin(t),y1=x0*sin(t)+y0*cos(t),其中t为旋转的角度. 代码如下: # include<iostream> # include<cmath> # include<algorithm> # include<cstdio> using namespace…
这道题目是13山东省省赛的签到题,题目大意是给等边三角形的两个定点,让求逆时针旋转之后的第三个点的坐标,原来不会向量的旋转,在网上找了找,找到一篇挺好的,直接贴过来. 向量的旋转 实际做题中我们可能会遇到很多有关及计算几何的问题,其中有一类问题就是向量的旋转问题,下面我们来具体探讨一下有关旋转的问题. 首…
L - Points on Cycle Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximiz…
题目大意: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2119 向量旋转的推导 #include <bits/stdc++.h> using namespace std; ; double add(double a,double b) { ; return a+b; } struct P { double x,y; P()…
一个简单的几何题,自己在纸上列出方程解出结果的表达式,再用程序表达出来就行了. 不过老司机(老司机的woodcoding)说用旋转向量法比较简单,有时间要去看一看. 大致题意:一个圆心在原点的圆,半径未知,现在给你圆上的一点,让你在这个圆上找到另外两点,使得这三点构成的三角形的周长最长. 样例输入:(第一行为一个整数N,表示后面有N组案例,每个案例给出一组圆上点的坐标) 2 1.500        2.000 563.585    1.251 样例输出:(其他两个点的坐标) 0.982 -2.…
Problem Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other you may assume that the radius of the cycle…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4613 题意: 判断一个集合中的点能不能由另一个集合中的点,通过平移,旋转,放缩得到~ 思路:先求出集合中的点的凸包,然后枚举每一条边作为起点 ,看原集合中的点能否与要比较的集合中的点一一对应~ #include <iostream> #include <cstdio> #include <algorithm> #include <functional> #inclu…
B题是这样子的: 将一个n元一维向量向左旋转(即循环移位)i个位置.例如,当n=8且i=3时,向量abcdefgh旋转为defghabc.简单的代码使用一个n元的中间向量在n步内完成该工作.你能否仅使用数十个额外字节的存储空间,在正比于n的时间内完成向量的旋转? 以下题目的解答部分参考自一博文及该书参考答案. 分析: “abcdefgh”严格来说并不是一个字符串,因为'\0'是不会移动的.为了叙述方便,可以把它认为是字符串,只是不对'\0'进行操作罢了. 如果不考虑时间要求为O(n),那么可以每…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个内角的三等分线.相交成三角形DEF.则DEF为等边三角形,你的任务是给你A,B,C点坐标求D,E,F的坐标 思路: 根据对称性,我们只要求出一个点其他点一样:我们知道三点的左边即可求出每个夹角,假设求D,我们只要将向量BC 旋转rad/3的到直线BD,然后旋转向量CB然后得到CD,然后就是求两直线的交点了.…
问题: 将一个n元一维向量向左旋转i个位置.例如,当n=8且i=3时,向量abcdefgh旋转为defghabc. 简单的代码使用一个n元的中间向量在n步内完成该工作. 你能否仅使用数十个额外字节的存储空间,在正比于n的时间内完成向量的旋转? 解法: 将x的前i个元素复制到一个临时数组中,然后将剩下的n-i个元素向左移动i个位置,最后将最初的i个元素从临时数组中复制到x中余下的位置.——使用i个额外位置产生过大的存储空间消耗: 定义一个函数将x向左旋转一个位置,时间正比于n,然后调用该函数i次.…
Problem Description There is a cycle with its center on the origin. Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other you may assume that the radius of the cycle…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1890 题解:splay又一高级的功能,区间旋转这个是用线段树这些实现不了的,这题可以学习splay的旋转方法还有splay tree是按照中序来的,也就是说中序遍历后会得到原序列所以建树和线段树差不多稍微有点不一样.其实splay tree核心操作就是splay就是将某个点移到goal下面优化bst的操作. #include <cstdio> #include <iostream> #…
向量AB,沿着n旋转10度 osg::Vec3 left = AB*osg::Matrix::rotate(osg::inDegrees(10), n); osg::Vec3 right = AB*osg::Matrix::rotate(osg::inDegrees(-10), n);//right=-left 特殊情况下,可以使用向量叉乘实现,例如旋转90度 osg::Vec3 left = n^AB; osg::Vec3 right = AB^n;…
Geometry Problem HDU - 6242 Alice is interesting in computation geometry problem recently. She found a interesting problem and solved it easily. Now she will give this problem to you : You are given NN distinct points (Xi,Yi)(Xi,Yi) on the two-dimens…
题目大意: 给定n条首尾相接的线段的长度 第一条从0,0开始,所有线段垂直与x轴向上延伸 给定c次操作 每次操作给定 s,a 使得 由第s条线段的角度 逆时针旋转a后 达到第s+1条线段的角度 每次操作后输出最后一条线段末尾端点的坐标 向量逆时针旋转公式为 x' = x * cos(A) - y * sin(A); y' = x * sin(A) + y * cos(A); 一个向量  (x,y)  可分解两个向量为 垂直于y轴的(x,0) 和垂直于x轴的 (0,y) 两个分向量逆时针A度后 (…
题意:现在给你一个矩形边框 一个三角形的三边长 现在问你能否把三角形放入矩阵边框中 并且输出三个点的坐标 思路:我们可以发现如果一定有解 我们就可以让一个点在左下角(0,0)处 还有一个点在矩形边上 所以我们暴力排列一下三个点 找到一个合适的三角形然后输出 #include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int N = 3e5+7; const int inf = 0x3f3f3…
思路来自于:http://www.cnblogs.com/wuyiqi/archive/2011/11/06/2238530.html 枚举两个多边形的两个点组成的直线,判断能与几个多边形相交 因为最佳的直线肯定可以经过某两个点(可以平移到顶点处),所以暴力枚举两个点就好了 如果有模版的话,写代码就快多了. 代码如下: #include <cstdio> #include <cstring> #include <cstdlib> #include <algorit…
http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11353 #include<iostream> #include<stdio.h> #include<string> #include<math.h> #define PI acos(-1) //using namespace std; struct Nod { int dir; int len; }node[]; str…