http://codeforces.com/problemset/problem/749/B 题意:已知平行四边形三个顶点,求另外一个顶点可能的位置. 思路:用向量来做. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> #include <cmath> #include <queue&g…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Carte…
题目链接: http://codeforces.com/contest/659/problem/D 题意: 若干条直线围城的湖,给定直线的端点,判断多少个转点会有危险?(危险是指直走的的话会掉进水里) 分析: 观察法:减去竖直水平的四条边,剩下的每两条边的交点就是答案. 求叉积:看两个向量夹角,如果夹角小于90度,则直走的话会掉进水里. 代码: #include<cstdio> #define sa(m) scanf("%d",&m) int main (void)…
Codeforces Round #198 (Div. 2) 题目链接:Maximal Area Quadrilateral Iahub has drawn a set of \(n\) points in the cartesian plane which he calls "special points". A quadrilateral is a simple polygon without self-intersections with four sides (also cal…
Problem B. Geometry ProblemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88926#problem/B Description Peter is studying in the third grade of elementary school. His teacher of geometry often gives h…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF1045E.html 4K码量构造题,CF血腥残暴! 题解 首先,如果所有点颜色相同,那么直接连个菊花搞定. 然后我们建个凸包. 如果凸包上有大于2段颜色(就是至少四段),比如这样 那么必然无解. 否则就只有一段颜色或者两段颜色: 这里我们先不管这个,考虑一个三角形的构造. 考虑三角形三个顶点颜色不全相同的情况,例如: (两个白点的情况是等价的) 假如三角形区域内没有白点,那么直接全部连到其中一个黑点就好了…
题目链接:Barcelonian Distance 题意:给定方格坐标,方格坐标上有两个点A,B和一条直线.规定:直线上沿直线走,否则沿方格走.求A到B的最短距离. 题解:通过直线到达的:A.B两点都有两种方式到直线上,最多4种情况,每种情况求出A.B点到直线的距离和直线上新的两点间距离,取4种情况中最优的. 不通过直线到达:$abs(x1-x2)+abs(y1-y2)$,最后与通过直线到达的最优情况比较,得到最优解. #include <cmath> #include <cstdio&…
题目链接: C. Recycling Bottles time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles…
题目链接 给出点A(x1,y1),B(x2,y2),和n条直线(ai,bi,ci,aix + biy + ci = 0),求A到B穿过多少条直线 枚举每条直线判断A.B是否在该直线两侧即可 #include<bits/stdc++.h> using namespace std; #define y1 asodifu double x1,y1,x2,y2; double a,b,c; ; bool check() { if((a*x1+b*y1+c)*(a*x2+b*y2+c)<eps)…
Parallelogram is Back CodeForces - 749B 已知平行四边形的三个顶点,求第四个顶点可能的位置.Input输入有三行,每行包括两个整数x和y ( - 1000 ≤ xi, yi ≤ 1000),代表一个顶点的横纵坐标.Output输出的第一行为一个整数k,代表第四个顶点可能的位置数.接下来k行,每行两个整数分别代表第四个顶点的横纵坐标.输出的点的顺序任意. Sample Input 0 0 0 1 1 0 Sample Output 3 -1 1 1 -1 1…