POJ 1696 Space Ant(点积的应用)】的更多相关文章

题意: 一只特别的蚂蚁,只能直走或者左转.在一个平面上,有很多株植物,这只蚂蚁每天需要进食一株,这只蚂蚁从起点为(0,miny)的点开始出发.求最多能活多少天 分析: 肯定是可以吃到所有植物的,以当前方向无限延长成直线,可以剩余的植物都在直线的左边.所以就是求上一个位置到当前位置与下一个位置与当前位置的夹角,并且使夹角最大. cos(0~pi)是单调递减的,夹角越大,cos值越小.所以我用点积来计算. #include <iostream> #include <cstdio> #i…
链接:http://poj.org/problem?id=1696 Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3077   Accepted: 1965 Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an a…
Space Ant 大意:有一仅仅蚂蚁,每次都仅仅向当前方向的左边走,问蚂蚁走遍全部的点的顺序输出.開始的点是纵坐标最小的那个点,開始的方向是開始点的x轴正方向. 思路:从開始点開始,每次找剩下的点中与当前方向所形成的夹角最小的点,为下一个要走的点(好像就是犄角排序,我不是非常会),夹角就是用点积除以两个向量的距离,求一下acos值. 之前一直用叉积做,做了好久例子都没过,发现用错了... 题目挺好的,有助于理解点积与叉积 struct Point{ double x, y; int id; }…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2489   Accepted: 1567 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…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3840   Accepted: 2397 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…
Space Ant Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3316   Accepted: 2118 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…
Space Ant Time Limit: 1000MS Memory Limit: 10000K 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 Y1999 and called it M11. It has only one eye o…
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…
Technorati Tags: POJ,计算几何,凸包 初学计算几何,引入polygon后的第一个挑战--凸包 此题可用凸包算法做,只要把压入凸包的点从原集合中排除即可,最终形成图形为螺旋线. 关于凸包,具体可见凸包五法:http://blog.csdn.net/bone_ace/article/details/46239187 此处简述我O(nH)的Jarvis法(H: 凸包上点数) 过程较易于理解. //POJ1696 //凸包变形 //AC 2016.10.13 #include "cs…
题目传送门 题意:一个蚂蚁一直往左边走,问最多能走多少步,且输出路径 分析:就是凸包的变形题,凸包性质,所有点都能走.从左下角开始走,不停排序.有点纠结,自己的凸包不能AC.待理解透凸包再来写.. 好像只能用卷包裹法来写,就是从一个起点出发,每次相对于起点用叉积排序,选择最外侧的点,更新起点. /************************************************ * Author :Running_Time * Created Time :2015/10/27 星期…