POJ 1556 E - The Doors】的更多相关文章

黑书上的一道例题:如果走最短路则会碰到点,除非中间没有障碍. 这样把能一步走到的点两两连边,然后跑SPFA即可. #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> #define N 100003 using namespace std; struct Point { double x, y; Point(double _x = 0, double _y = 0) :…
题意:给定n堵墙,现在要你从(0,5)走去(10,5)的最短距离 思路:刚开始还想模拟,就是从(0,5)走,每次x向右一格,然后判断有没和线段相交就可以.但是它的们有可能是小数形式给出的,这样就GG了(x--x+1中可能存在很多门).正确的方法应该是建图,对于所有门,他们都有端点的,先把他们加入到图中,包括起点的话,一共有num个点吧.然后暴力判断e[i][j]是否能到达就可以,这里用线段相交就可以判断.然后floyd一下就好.bug点:门的端点不应该加进来,就是(x,0).(x,10)这样的点…
POJ 1556 - The Doors题意:    在 10x10 的空间里有很多垂直的墙,不能穿墙,问你从(0,5) 到 (10,5)的最短距离是多少.    分析:        要么直达,要么一定是墙的边缘点之间以及起始点.终点的连线.        所以先枚举墙上每一点到其他点的直线可达距离,就是要判定该线段是否与墙相交(不含端点).        然后最短路. #include <iostream> #include <cstdio> #include <cmat…
LINK 题意:在$10*10$的几何平面内,给出n条垂直x轴的线,且在线上开了两个口,起点为$(0, 5)$,终点为$(10, 5)$,问起点到终点不与其他线段相交的情况下的最小距离. 思路:将每个开口的两端点作为一个节点,再枚举点与点间能否直接到达(判相交),以此建图求最短路. /** @Date : 2017-07-11 16:17:31 * @FileName: POJ 1556 线段交+dijkstra 计算几何.cpp * @Platform: Windows * @Author :…
// 最短路+线段交 POJ 1556 好题 // 题意:从(0,5)到(10,5)的最短距离,中间有n堵墙,每堵上有两扇门可以通过 // 思路:先存图.直接n^2来暴力,不好写.分成三部分,起点 终点和之间的点:中间点之间:起点和终点的距离 // n最大为18所以直接n^3最短路 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include &l…
题目链接:http://poj.org/problem?id=1556 Time Limit: 1000MS Memory Limit: 10000K Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y…
The Doors Time Limit: 1000 MS Memory Limit: 10000 KB 64-bit integer IO format: %I64d , %I64u   Java class name: Main [Submit] [Status] [Discuss] Description You are to find the length of the shortest path through a chamber containing obstructing wall…
The Doors Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5210   Accepted: 2124 Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x =…
  The Doors Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7430   Accepted: 2915 Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x…
The Doors Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6734   Accepted: 2670 Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x =…