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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(线段相交)的更多相关文章

  1. 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 ...

  2. zoj 1010 Area【线段相交问题】

    链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 http://acm.hust.edu.cn/vjudge/ ...

  3. ZOJ 1648 Circuit Board(计算几何)

    Circuit Board Time Limit: 2 Seconds Memory Limit: 65536 KB On the circuit board, there are lots of c ...

  4. Printed Circuit Board (board)

    Printed Circuit Board (board) 题目描述 给出一个N个顶点的简单多边形,对于每个顶点,假如它和原点连成的线段只在这个顶点处和多边形相交,就称为满足要求的顶点.你的任务是输出 ...

  5. POJ 1066 Treasure Hunt (线段相交)

    题意:给你一个100*100的正方形,再给你n条线(墙),保证线段一定在正方形内且端点在正方形边界(外墙),最后给你一个正方形内的点(保证不再墙上) 告诉你墙之间(包括外墙)围成了一些小房间,在小房间 ...

  6. POJ 2653 Pick-up sticks (线段相交)

    题意:给你n条线段依次放到二维平面上,问最后有哪些没与前面的线段相交,即它是顶上的线段 题解:数据弱,正向纯模拟可过 但是有一个陷阱:如果我们从后面向前枚举,找与前面哪些相交,再删除前面那些相交的线段 ...

  7. 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 ...

  8. POJ 2653 Pick-up sticks【线段相交】

    题意:n根木棍随意摆放在一个平面上,问放在最上面的木棍是哪些. 思路:线段相交,因为题目说最多有1000根在最上面.所以从后往前处理,直到木棍没了或者最上面的木棍的总数大于1000. #include ...

  9. POJ 1556 The Doors【最短路+线段相交】

    思路:暴力判断每个点连成的线段是否被墙挡住,构建图.求最短路. 思路很简单,但是实现比较复杂,模版一定要可靠. #include<stdio.h> #include<string.h ...

随机推荐

  1. cakephp之查询

    find public find( string $type 'first' , array $query array() ) Queries the datasource and returns a ...

  2. Linux/Android 性能优化工具 perf

    /***************************************************************************** * Linux/Android 性能优化工 ...

  3. DelegatingFilterProxy

    安全过滤器链 Spring Security的web架构是完全基于标准的servlet过滤器的. 它没有在内部使用servlet或任何其他基于servlet的框架(比如spring mvc), 所以它 ...

  4. python编码问题(1)

    一.字符编码基础 字符编码是计算机对字符的格式化,从而能够在计算机系统中存储与传输. 1.ASCII码 在计算机内部,所有的信息最终都表示为一个二进制的字符串.每一个二进制位(bit)有0和1两种状态 ...

  5. HDU 4750

    解题方法,,,首先应该可以看出来是一颗 最小生成树,任意一条的边的价值是不同的:所以计算出最小生成树的每一条边有多少对顶点满足他的 f 值就是这条边的 权值,因此可以在生成最小生成树的时候,进行一下统 ...

  6. Heritrix源码分析(十五) 各种问题总结(转)

    开博客以及建立Heritrix 群有一段时间了(这里谢谢大家的关注),这篇博客将整理这段时间所遇到的问题.同时由于自己从今年5月份开始就不怎么接触Heritrix,很多东西开始遗忘(不过里面思想没忘) ...

  7. OpenVz一键安装openvpn

    # !/bin/sh # OPENVPN SERVER CONFIGURATION echo "####################################" echo ...

  8. ArcEngine 通过SpatialRelDescription删除不相交要素

    ISpatialFilter.SpatialRel设置为esriSpatialRelRelate,并且设置SpatialRelDescription为某个字符串.该字符串的构造方法:该字符串为长度为9 ...

  9. Android百度地图开发(一)环境搭建

    1.百度地图官方API文档下载 版本 使用说明 下载 Android SDK 通用资源下载 <离线地图>提供新版离线地图(百度矢量地图)与旧版离线地图(百度栅格地图)下载. 备注: 自An ...

  10. JavaScript 教程学习进度备忘

    书签:"JavaScript 课外书"即“JS 教程”底部的“马上开始学习 JavaScript 高级教程吧 !”链接跳过,它属于高级教程:另外跳过的内容有待跟进 ________ ...