Codeforces 559A(计算几何)】的更多相关文章

A. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to .…
Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. Th…
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sid…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF-Gym100543B.html 题目传送门 - CF-Gym100543B 题意 给定一个折线图,对于每一条折线,问沿着这条折线往右看第一个看到的线段的编号(如果视线恰好看到上端点,则当没看见) 放张图片助于理解: 折线图用 $n$ 个点来描述. $n\leq 100000,\ \ \ \ 坐标范围:(x,y)|0\leq x,y\leq 10^9$ 题解 这题好妙啊. 首先一个结论:如果射线与一段区间的…
题意:面积是sqrt(3)/4的多少倍? 做延长线 #pragma comment(linker,"/STACK:1024000000,1024000000") #include<iostream> #include<cstdio> #include<string> #include<cstring> #include<vector> #include<cmath> #include<queue> #i…
题意:按顺序给出一个各内角均为120°的六边形的六条边长,求该六边形能分解成多少个边长为1的单位三角形. 把单位三角形面积看做1,实际上就是求六边形面积.随便找六边形的三条互相不相邻的边,分别以这三条边为基础向外扩展一个等边三角形.就可以将原六边形补成一个大等边三角形,然后用大等边三角形面积减去补上的3个小等边三角形面积就是原来六边形的面积. 而等边三角形面积非常easy.就是边长的平方(实际就是边长为n的等边三角形能分解成n^2个边长为1的单位三角形,画个图就能理解了). #include <…
C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/605/problem/C Description Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool pro…
http://codeforces.com/problemset/problem/749/B 题意:已知平行四边形三个顶点,求另外一个顶点可能的位置. 思路:用向量来做. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> #include <cmath> #include <queue&g…
A. Peter and Snow Blower 题目连接: http://www.codeforces.com/contest/613/problem/A Description Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not…
传送门 https://www.cnblogs.com/violet-acmer/p/10146350.html 题意: 有一块 n*m 的棋盘,初始,黑白块相间排列,且左下角为白块. 给出两个区间[ (x1,y1) , (x2,y2) ] 和 [ (x3,y3) , (x4,y4) ],第一个区间全部涂成白色,第二个区间全部涂成黑色,且颜色会覆盖. 求两块区间按照要求涂完后白块和黑快的个数? 题解: 我的想法如下: 先求出初始的黑块个数,然后,求出第一个区间减少的黑块个数,再求出第二个区间增加…
题目传送门 传送点I 传送点II 传送点III 题目大意 给定$n$的平面上的直线,保证没有三条直线共点,两条直线平行.问随机选出3条直线交成的三角形面积的期望. 显然$S=\frac{1}{2}ah$是不可用的.(压根感觉不可优化) 考虑向量的做法:$S = \frac{1}{2}(A \times B + B \times C + C\times A)$.(相当于把一个三角形拆成了三个以原点作为其中一个顶点的"有向"三角形) 于是考虑利用向量叉积对向量加法的分配律进行优化. 枚举第…
A. Crazy Town 题目连接: http://codeforces.com/contest/498/problem/A Description Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The r…
E. Runaway to a Shadow 题目连接: http://www.codeforces.com/contest/681/problem/E Description Dima is living in a dormitory, as well as some cockroaches. At the moment 0 Dima saw a cockroach running on a table and decided to kill it. Dima needs exactly T…
C. Ancient Berland Circus 题目连接: http://www.codeforces.com/contest/1/problem/C Description Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circuses were s…
题目链接: http://codeforces.com/contest/659/problem/D 题意: 若干条直线围城的湖,给定直线的端点,判断多少个转点会有危险?(危险是指直走的的话会掉进水里) 分析: 观察法:减去竖直水平的四条边,剩下的每两条边的交点就是答案. 求叉积:看两个向量夹角,如果夹角小于90度,则直走的话会掉进水里. 代码: #include<cstdio> #define sa(m) scanf("%d",&m) int main (void)…
传送门 题意:在平面中,有一个圆,有一个点,问能在这个圆中围出最大的圆的圆心坐标和半径.要求这个最大圆不包含这个点. 思路:比较基础的计算几何,要分三种情况,第一种就是这个点在圆外的情况.第二种是点在圆内.第三种是这个点和圆心重合. ac代码 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <string> #includ…
Codeforces 这题--真是搞死我了-- 好不容易下定了决心要不颓废,要写题,结果一调就调了十几个小时-- 思路 我们发现在树上做非常不舒服,于是树链剖分之后一次在重链上的移动就可以看做是在dfs序上移动,也就是在序列上走. 于是把时间作为\(x\)轴,dfs序作为\(y\)轴,那么一次移动就可以看做一条线段. 我们就要找所有线段里面最早相交的交点. 这是一个经典问题.我们在\(x\)坐标上面扫描线,用set维护线段,加入线段的时候求一下和前驱后继的交点,删除的时候求一下前驱后继的交点,一…
题目链接: https://codeforces.com/contest/1163/problem/C2 题意: 给出$n$个点,任意两点连接一条直线,求相交直线的对数 数据范围: $1 \le n \le 10^3$ 分析: 先建立所有的直线,可以把直线定义成$ax+ by=c$,但是需要把$a$和$b$的大小化简成最小,保证直线的唯一性 $k=\frac{y_{1}-y_{2}}{x_{1}-x_{2}}$,上下化简,再用点斜式构造$ax+ by=c$ ac代码: #include<bits…
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…
传送门 •题意 先给一个白矩阵,再两个黑矩阵 如果两个黑矩阵能把白矩阵包含,则输出NO 否则输出YES •思路 计算几何题还是思维题呢? 想起了上初中高中做几何求面积的题 这个就类似于那样 包含的话分两种情况讨论,其他的不包含 ①白矩形在一个黑矩形内部 这种情况直接判断边界就可以 ②白矩形在两个黑矩形组合的图形内部 首先这个情况的前提是两个黑矩形必须能连接起来 白矩形和两个黑矩形分别会有重合,重合的地方可能会在此重合, 例如 白矩形(1 1 4 2)   黑1矩形(1 0 3 4)  黑2矩形(…
题目地址 简要题意: 给出两个点的坐标,以及一些一般直线方程Ax+B+C=0的A.B.C,这些直线作为街道,求从一点走到另一点需要跨越的街道数.(两点都不在街道上) 思路分析: 从一点到另一点必须要跨的街道等价于两点一点在这条直线一侧,另一条在另一侧.只需要将两点坐标带进去,一正一负即可.将这些直线依次检验,统计总和. #include<stdio.h> #include<bits/stdc++.h> #include <iostream> using namespac…
传说中做cf不补题等于没做 于是第一次补...这次的cf没有做出来DE D题的描述神奇 到现在也没有看懂 于是只补了E 每次div2都是hack前2~3题 终于打出一次hack后的三题了...希望以后能越来越好 早日..至少变成蓝色名字吧:) E题意 有一个蟑螂 人要打死它 给出蟑螂的坐标 速度 人的瞄准时间 再给出一些阴影(圆形且给出坐标与半径) 若蟑螂移动到阴影内会立即停下 人不能打到阴影中的蟑螂 问它不被打死的机率 蟑螂的移动方向是随机的 需要注意的是蟑螂只会朝一个方向走直线 所以我们对于…
题目链接: B. Chip 'n Dale Rescue Rangers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signa…
Alyona and Triangles 题目连接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/J Description You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n point…
ShitáliaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88994#problem/A Description After suddenly becoming a billionaire, Shi adopted YOLO as his motto and decided to buy a small european island, wh…
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…
K - Cross SpiderTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87794#problem/K Description The Bytean cross spider (Araneida baitoida) is known to have an amazing ability. Namely, it can instantly b…
Problem A. AerodynamicsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86821#problem/A Description Bill is working in a secret laboratory. He is developing missiles for national security projects. Bi…
主题链接:点击打开链接 必须指出的是,反射镜和2个人共线是不是障碍,但根据该壁其他情况 #include<cstdio> #include<iostream> #include<algorithm> #include<string.h> #include<math.h> using namespace std; #define point Point const double eps = 1e-8; const double PI = acos(…
问有多少个点在多边形内 求一遍叉积 小于零计数就好了~ #include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<string> #include<map> #include<set> #include<vector> #include<queue&…