摘要: atan2是C++的一个很实用的函数,可以用于极角排序。 atan2(y,x)的值即为坐标为(x,y)的点与原点的连线和x轴正方向的夹角的弧度制。 极角排序排完以后,点从x负半轴开始,逆时针转一圈。 在极角排序的使用方法: int cmp(node x,node y){ if (atan2(x.y, 阅读全文
posted @ 2020-09-25 19:55 Mohogany 阅读(1223) 评论(0) 推荐(0) 编辑
摘要: 例题:P2742 [USACO5.1]圈奶牛Fencing the Cows /【模板】二维凸包 https://www.luogu.com.cn/problem/P2742 之前一直没有学习过计算几何的知识,也没有遇到相关的题。但是最近发现这类型的题多了起来,于是决定学习一下计算几何的知识。 以这 阅读全文
posted @ 2020-09-24 22:11 Mohogany 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Vasya likes to travel by train, but doesn't like when the car he travels in is located in the tail of the train. Vasya gets on the train at the statio 阅读全文
posted @ 2020-09-24 21:01 Mohogany 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 这题很容易可以转换模型,把操作一转换为纵坐标改变一个小于2*(l-1)的偶数的值,操作二转换为横纵坐标同时改变一个小于(l-1)的值。 然后贪心处理。 容易想到操作二最多进行一次,所以只要枚举是否进行操作二然后取最大值就可以了。 有一个问题要注意,当操作二改变的值为(l-2)时,可能要再次改变一次( 阅读全文
posted @ 2020-09-23 22:17 Mohogany 阅读(117) 评论(0) 推荐(0) 编辑