POJ 2253 Frogger(最小最大距离)】的更多相关文章

题意  给你n个点的坐标  求第1个点到第2个点的全部路径中两点间最大距离的最小值 非常水的floyd咯 #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; const int N=205; double d[N][N]; int x[N],y[N],n; void floyd() { for(int k=1;k<=n;+…
传送门: http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 58328   Accepted: 18293 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on a…
<题目链接> 题目大意: 给出青蛙A,B和若干石头的坐标,现青蛙A想到青蛙B那,A可通过任意石头到达B,问从A到B多条路径中最小的最长边. 解题分析: 这是最短路的一类典型题目,与普通的最短路的不同之处在于松弛操作. #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> using namespace std; #define N 205 int n;…
题目传送门 /* 最短路:Floyd算法模板题 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <vector> using namespace std; + ; const int INF = 0x3f3f3f3f; do…
POJ 2253 Frogger题目意思就是求所有路径中最大路径中的最小值. #include<iostream> #include<cstdio> #include<string.h> #include <utility>//make_pair的头文件 #include<math.h> using namespace std; ; double map[maxn][maxn]; int n; typedef struct pair<int…
POJ. 2253 Frogger (Dijkstra ) 题意分析 首先给出n个点的坐标,其中第一个点的坐标为青蛙1的坐标,第二个点的坐标为青蛙2的坐标.给出的n个点,两两双向互通,求出由1到2可行通路的所有步骤当中,步长最大值. 在dij原算法的基础上稍作改动即可.dij求解的是单源最短路,现在求解的是步长最大值,那么更新原则就是,当前的这一步比保存的步如果要大的话,就更新,否则就不更新. 如此求解出来的就是单源最大步骤. 代码总览 #include <cstdio> #include &…
POJ 2253 Frogger Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimmin…
Frogger Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2253 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone…
原题链接:http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30637   Accepted: 9883 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on an…
题目链接:http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 38366   Accepted: 12357 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on a…
题目链接:http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25773   Accepted: 8374 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on an…
链接:poj 2253 题意:给出青蛙A,B和若干石头的坐标,现青蛙A想到青蛙B那,A可通过随意石头到达B, 问从A到B多条路径中的最长边中的最短距离 分析:这题是最短路的变形,曾经求的是路径总长的最小值,而此题是通路中最长边的最小值,每条边的权值能够通过坐标算出,由于是单源起点,直接用SPFA算法或dijkstra算法就能够了 SPFA 16MS #include<cstdio> #include<queue> #include<cmath> #include<…
链接: http://poj.org/problem?id=2253 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/D Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21206   Accepted: 6903 Description Freddy Frog is sitting on a stone in the…
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimming and instead rea…
Til the Cows Come Home 题目链接: http://acm.hust.edu.cn/vjudge/contest/66569#problem/A Description The input will contain one or more test cases. The first line of each test case will contain the number of stones n (2<=n<=200). The next n lines each con…
题目:http://poj.org/problem?id=2253 题意:给出两只青蛙的坐标A.B,和其他的n-2个坐标,任一两个坐标点间都是双向连通的.显然从A到B存在至少一条的通路,每一条通路的元素都是这条通路中前后两个点的距离,这些距离中又有一个最大距离. 现在要求求出所有通路的最大距离,并把这些最大距离作比较,把最小的一个最大距离作为青蛙的最小跳远距离. #include <iostream> #include<cstdio> #include<cstring>…
http://poj.org/problem?id=2253 题意 : 题目是说,有这样一只青蛙Freddy,他在一块石头上,他呢注意到青蛙Fiona在另一块石头上,想去拜访,但是两块石头太远了,所以他只有通过别的石头跳过去,所以,从他的石头到Fiona的石头每一条可走的路,假设是n条,就需要你求出frog distance,这个所谓的距离就是指这n条路中,每条路选取组成这条路中最长的那边,最后一共有n条边,找这n条边里最短的那一条输出. 思路 : 就是一个最短路的问题,不过不需要求最短路的权值…
Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30427   Accepted: 9806 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her,…
Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 24879   Accepted: 8076 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her,…
题目链接: http://poj.org/problem?id=2253 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' suns…
题目链接:http://poj.org/problem?id=2253 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunsc…
http://poj.org/problem?id=2253 题意: 有两只青蛙A和B,现在青蛙A要跳到青蛙B的石头上,中间有许多石头可以让青蛙A弹跳.给出所有石头的坐标点,求出在所有通路中青蛙需要跳跃距离的最小值. 思路: dijkstra算法的变形.本来是dist是记录最短距离,在这道题中可以把它变为已经跳过的最大距离,稍微改一下松弛算法就可以.具体见代码. #include<iostream> #include<algorithm> #include<string>…
题目链接:http://poj.org/problem?id=1797 题意:给出两只青蛙的坐标A.B,和其他的n-2个坐标,任一两个坐标点间都是双向连通的.显然从A到B存在至少一条的通路,每一条通路的元素都是这条通路中前后两个点的距离,这些距离中又有一个最大距离.现在要求求出所有通路的最大距离,并把这些最大距离作比较,把最小的一个最大距离作为青蛙的最小跳远距离. 有一个明显的方法就是dfs一遍但是肯定会te,所以可以考虑一下用dp的思想. 类似记忆化搜索的思想,由于数据比较小所以不用记忆化搜索…
这题的坑点在POJ输出double不能用%.lf而要用%.f...真是神坑. 题意:给出一个无向图,求节点1到2之间的最大边的边权的最小值. 算法:Dijkstra 题目每次选择权值最小的边进行延伸访问,最坏情况下每条路径都要访问,复杂度O(n^2) 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm>…
http://poj.org/problem?id=2253 #include <iostream> #include <queue> #include <cmath> #include <iomanip> using namespace std; queue <int > que; int co[202][2]; double d[202][202],u[202][202]; int n; int main(){ ios::sync_with_…
青蛙跳跃,题意大概是:青蛙从起点到终点进行一次或多次的跳跃,多次跳跃中肯定有最大的跳跃距离.求在所有的跳跃中,最小的最大跳跃距离SF-_-(不理解?看题目吧). 可以用最小生成树完成.以起点为根,生成一棵最小生成树,直到树里包含了终点. 或者这么说吧,类似于Kruskal算法,我们每次选取不成环的最小边,直到这棵树选取了通往终点的最小边,那么最后选择的这条边必然是在树中最大的一条边,而且在其余的边中是最小的.你不会找到比这条边小的最大距离,因为比它小的最小距离都在树里了,而未选取该边前树中不包含…
题目:click here 题意: 给出两只青蛙的坐标A.B,和其他的n-2个坐标,任意两坐标间是双向连通的.显然从A到B存在至少一条的通路,每一条通路的元素都是这条通路中前后两个点的距离,这些距离中又有一个最大距离.现在要求求出所有通路的最大距离,并把这些最大距离作比较,把最小的一个最大距离作为青蛙的最小跳远距离. 分析: 最小化最大值-------- #include <iostream> #include <cstdio> #include <cstring> #…
Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22557   Accepted: 7339 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her,…
题目链接:http://poj.org/problem?id=2253 题目意思:找出从Freddy's stone  到  Fiona's stone  最短路中的最长路. 很拗口是吧,举个例子.对于 i 到 j 的一条路径,如果有一个点k, i 到 k 的距离 && k 到 j 的距离都小于 i 到 j 的距离,那么就用这两条中较大的一条来更新 i 到 j 的距离 .每两点之间都这样求出路径.最后输出 1 到 2 的距离(1:Freddy's stone   2:Fiona's sto…
传送门 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 39453   Accepted: 12691 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit…