题意: 给出三角形的三个点的坐标(浮点数),     问落在三角形内及三角形边上的整点有多少? 思路:所有点暴力判断(点的范围1-99,三角形可能是0-100,因为这个WA了一下orz) AC代码: #include<cstdio> #include<cmath> #include<algorithm> #include<iostream> #include<cstring> using namespace std; typedef long l…
题目大意:果园里的树排列成矩阵,它们的x和y坐标均是1~99的整数.输入若干三角形,依次统计每一个三角形内部和边界上共有多少棵树. 三角形P0P1P2有向面积为A:2A = x0y1 + x2y0 + x1y2 - x2y1 - x0y2 - x1y0.如果三角形的三个顶点呈逆时针排列,那么有向面积为正,如果是顺时针排列,则有向面积为负.假设输入三角形为ABC,待判断点为O,则O在三角形ABC内部或边界上当且仅当SABC = SOAB + SOBC + SOAC.通过对有向面积取绝对值可以避免三…
Orchard Trees Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 418    Accepted Submission(s): 101 Problem Description An Orchardist has planted an orchard in a rectangle with trees uniformly spac…
要注意如果是XY坐标轴的2D空间,要取差乘分量z而不是y. 实现原理是,将三角形ABC三个边(AB,BC,CA)分别与比较点判断差乘,如果这3个差乘结果表示的方向一致,说明就在三角形内. 效果: 代码(Unity3D): using UnityEngine; using System.Collections; using System.Collections.Generic; public class TriangleCollider : MonoBehaviour { public const…
围困 Time Limit: 1000 MS     Memory Limit: 65536 K Total Submit: 360(138 users) Total Accepted: 157(129 users)   Rating:  Special Judge: No Description Leyni是一名猎人,一天他在草原中散步,遇到了三只老狼,三只老狼围成了一个三角形,如果Leyni在这个三角形中,那么他必死无疑,否则他还有一线生机. 现在已知三只老狼的坐标和Leyni的坐标,请问,…
参考资料: 题目: https://blog.csdn.net/dongtinghong/article/details/78657403 符号重载: https://blog.csdn.net/cdlwhm1217096231/article/details/89326480#commentBox const: https://blog.csdn.net/kaida1234/article/details/80403534 题目: 已知平面中1个点P和平面内1个三角形(3个顶点坐标A.B.C)…
描述 Given the coordinates of the vertices of a triangle,And a point. You just need to judge whether the point is in the Triangle. 输入 The input contains several test cases. For each test case, only line contains eight integer numbers , describing the c…
题意:圆上有n个点,求出这n个点组成的所有三角形的面积之和 题解: 当我们要求出S(i,j,k)时,我们需要假设k在j的左侧,k在i与j之间,k在i的右侧. 如果k在 j的左侧  那么 S(i,j,k) = S(i,k,o)+s(i,j,o) - s(k,i,o); 显然 只要k在j的左侧  s(i,j,0) 在用来求 做和用的. 如果k在 的i右侧  那么 S(i,j,k) = S(i,k,o)+s(i,j,o) - s(k,j,o); 显然 只要k在i的右侧  s(i,j,0) 在用来求 做…
Finding Mine Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1120    Accepted Submission(s): 298 Problem Description In bitland, there is an area with M gold mines. As a businessman, Bob wants t…
poj 2954 Triangle 题意 给出一个三角形的三个点,问三角形内部有多少个整点. 解法 pick's law 一个多边形如果每个顶点都由整点构成,该多边形的面积为\(S\),该多边形边上的整点为\(L\),内部的整点为\(N\),则有: $ N + L/2 - 1 = S $ 而对于两个点\(A(x_1,y_1)\)与\(B(x_2,y_2)\),其边内部的整点数为:(不包含端点) $ gcd ( abs(x_1 - x_2) , abs(y_1 - y_2) ) - 1 $ 代码如…