CF55E.Very simple problem
省选/NOI-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a convex polygon. Count, please, the number of triangles that contain a given point in the plane and their vertices are the vertices of the polygon. It is guaranteed, that the point doesn't lie on the sides and the diagonals of the polygon.
给你一个凸多边形。请计算满足以下条件的三角形的个数:该三角形包含给定的平面上一点,且其三个顶点均为该多边形的顶点。保证该给定点不位于多边形的任意一条边或对角线上。
输入格式
The first line contains integer n — the number of vertices of the polygon (3 ≤ n ≤ 100000). The polygon description is following: n lines containing coordinates of the vertices in clockwise order (integer x and y not greater than 109 by absolute value). It is guaranteed that the given polygon is nondegenerate and convex (no three points lie on the same line).
The next line contains integer t (1 ≤ t ≤ 20) — the number of points which you should count the answer for. It is followed by t lines with coordinates of the points (integer x and y not greater than 109 by absolute value).
第一行包含一个整数 n —— 多边形的顶点数(3≤n≤100000)。随后是多边形的描述:n 行,每行包含一个顶点的坐标,按顺时针顺序给出(整数 x 和 y 的绝对值均不超过 109)。保证所给多边形是非退化的且为凸多边形(任意三点不共线)。
接下来一行包含一个整数 t(1≤t≤20)—— 需要计算答案的点的个数。随后是 t 行,每行包含一个点的坐标(整数 x 和 y 的绝对值均不超过 109)。
输出格式
The output should contain t integer numbers, each on a separate line, where i-th number is the answer for the i-th point.
Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).
输出应包含 t 个整数,每个整数占一行,其中第 i 个数为第 i 个点的答案。
请注意,在 C++ 中读写 64 位整数时,请勿使用 %lld 格式说明符。推荐使用 cin(也可使用 %I64d)。
输入输出样例
输入#1
4 5 0 0 0 0 5 5 5 1 1 3
输出#1
2
输入#2
3 0 0 0 5 5 0 2 1 1 10 10
输出#2
1 0
输入#3
5 7 6 6 3 4 1 1 2 2 4 4 3 3 2 3 5 5 4 2
输出#3
5 3 3 4
输入解题思路,AI测评打分。不知道怎么写?