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2RXKlovPlfyGhxwS7yhd/Gr+sXaovzcKtuFO9HWGLH53e1gs0q1ojDZuEfpwHL/7APo12fxfa15xbKFtfdlYZHZ29B3PIO5fQ7oLhwSBKT8Kk3SG8SsobIRzSZILL/t3Xdo4l3Llazkhq4oRqSy41GoX4vejPtAWD+MWztYPhTdVt+6osot034u9CF+Ea85zYn1kTzld+dkzMyxtnV34WfLuF6TNJmXv8RaiN5R+1ck6r3KuSYNAfSRB8LkmN+4ZHWRhMOST5d+/nuFxHrxTebTh7okXdX8VAqwZ2R73fGASAg5uGIK37xQSLxaavuMNOOb68TYMWOejf6SkRq9oiDeMotBftDEw/75TnxbHQRt+99+knKvtV2vZRxIUiE8RDukxQzty9+2rsWKyayDJwqLgvY6NguBeTYNzCIJ70VdOJ6lCjhP50F6aJLVfOjkKPkZuzluVf6wkCAPoGJDQAAGwBnSh+9066v/vzXTH/RR4AoN+MWELfvVcS17i+4p4TBAD0G0hoAAAAAICh8X8r1kBkO8R9GQAAAABJRU5ErkJggg==" alt="" width="761" height="23" />
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define eps 1e-12
#define MAXN 2005
#define INF 1000000007
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
#define mem(a) memset(a,0,sizeof(a)) struct Point{
double x,y;
Point(double x=, double y=):x(x),y(y){}
}; double Cross(Point A, Point B) { return A.x*B.y - A.y*B.x;}//叉积 int N;
struct LINE
{
Point s, e;
} Line[MAXN]; int main()
{
while(~scanf("%d", &N))
{
for(int i=;i<N;i++)
{
scanf("%lf%lf%lf%lf", &Line[i].s.x, &Line[i].s.y, &Line[i].e.x, &Line[i].e.y);
}
int ok = ;
for(int i=;i<N && ok;i++)
{
Point Pi = Point(Line[i].e.x-Line[i].s.x, Line[i].e.y-Line[i].s.y);
for(int j=i+;j<N && ok; j++)
{
double c1 = Cross(Point(Line[j].s.x-Line[i].s.x, Line[j].s.y-Line[i].s.y), Pi);
double c2 = Cross(Point(Line[j].e.x-Line[i].s.x, Line[j].e.y-Line[i].s.y), Pi);
if(c1 * c2 < )
{
Point Pj = Point(Line[j].e.x-Line[j].s.x, Line[j].e.y-Line[j].s.y);
c1 = Cross(Point(Line[i].s.x-Line[j].s.x, Line[i].s.y-Line[j].s.y), Pj);
c2 = Cross(Point(Line[i].e.x-Line[j].s.x, Line[i].e.y-Line[j].s.y), Pj);
if (c1 * c2 < ) ok = ;
}
}
}
printf("%s\n",ok?"ok!":"burned!");
}
return ;
}
ZOJ1648 Circuit Board(线段相交)的更多相关文章
- ZOJ1648 Circuit Board 2017-04-18 20:31 34人阅读 评论(0) 收藏
Circuit Board Time Limit: 2 Seconds Memory Limit: 65536 KB On the circuit board, there are lots ...
- zoj 1010 Area【线段相交问题】
链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 http://acm.hust.edu.cn/vjudge/ ...
- ZOJ 1648 Circuit Board(计算几何)
Circuit Board Time Limit: 2 Seconds Memory Limit: 65536 KB On the circuit board, there are lots of c ...
- Printed Circuit Board (board)
Printed Circuit Board (board) 题目描述 给出一个N个顶点的简单多边形,对于每个顶点,假如它和原点连成的线段只在这个顶点处和多边形相交,就称为满足要求的顶点.你的任务是输出 ...
- POJ 1066 Treasure Hunt (线段相交)
题意:给你一个100*100的正方形,再给你n条线(墙),保证线段一定在正方形内且端点在正方形边界(外墙),最后给你一个正方形内的点(保证不再墙上) 告诉你墙之间(包括外墙)围成了一些小房间,在小房间 ...
- POJ 2653 Pick-up sticks (线段相交)
题意:给你n条线段依次放到二维平面上,问最后有哪些没与前面的线段相交,即它是顶上的线段 题解:数据弱,正向纯模拟可过 但是有一个陷阱:如果我们从后面向前枚举,找与前面哪些相交,再删除前面那些相交的线段 ...
- HDU1086You can Solve a Geometry Problem too(判断线段相交)
You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3 ...
- POJ 2653 Pick-up sticks【线段相交】
题意:n根木棍随意摆放在一个平面上,问放在最上面的木棍是哪些. 思路:线段相交,因为题目说最多有1000根在最上面.所以从后往前处理,直到木棍没了或者最上面的木棍的总数大于1000. #include ...
- POJ 1556 The Doors【最短路+线段相交】
思路:暴力判断每个点连成的线段是否被墙挡住,构建图.求最短路. 思路很简单,但是实现比较复杂,模版一定要可靠. #include<stdio.h> #include<string.h ...
随机推荐
- HDU 2066 一个人的旅行【Dijkstra 】
题意:给出s个起点,d个终点,问从这些起点到达终点的最短距离 因为有多个起点,所以把这多个起点的值设为0 哎= =改了好久的说= = 是因为在代码里面的t,不知道为什么调用dijkstra()函数之后 ...
- 20160204.CCPP体系详解(0014天)
程序片段(01):define.h+data.h&data.c+control.h&control.c+view.h&view.c+AI.h&AI.c+main.c 内 ...
- Python 删除 数组
numpy删除一列 从0开始,第三个参数是第几个维度 可以多删几个
- UML时序图
时序图定义 : 描述了对象之间传递消息的时间顺序, 用来表示用例中的行为顺序, 是强调消息时间顺序的交互图; 时序图描述的事物: 时序图描述系统中类和类之间的交互, 将这些交互建模成消息交换, 时序图 ...
- Hadoop 学习总结之一:HDFS简介
一.HDFS的基本概念 1.1.数据块(block) HDFS(Hadoop Distributed File System)默认的最基本的存储单位是64M的数据块. 和普通文件系统相同的是,HDFS ...
- 嵌入式 hi3518平台多路码流添加osd
<span style="font-family:Courier New;"> /******************************************* ...
- JAVA CAS原理、unsafe、AQS
concurrent包的实现 由于java的CAS同时具有 volatile 读和volatile写的内存语义,因此Java线程之间的通信现在有了下面四种方式: A线程写volatile变量,随后B线 ...
- location.hash来保持页面状态
/*本例是为了在客户端页面返回时保存状态,采用hash值记录的模式,为了使用方便所写的存取hash值的库,时间仓促,望指出错误.*/var pageStateHash = { hashArray: [ ...
- 设计模式 策略-Strategy,装饰-Decorator,观察者-Observer
重温了Head First 3个设计模式.提炼一下思想,笔记如下. 策略-Strategy 当一个类或类族中重复实现某些同类的方法(behavior)时,考虑使用策略模式. 该模式是将Behavior ...
- Mac下用命令行直接批量转换文本编码到UTF8
由于近期在Mac下写Android程序,下载的一些Demo由于编码问题源码里的汉字出现乱码,文件比较多,所以想批量解决下文件的编码问题. Mac下有以下两种方式可以解决: A. 文件名的编码:Mac的 ...