POJ2253 Frogger】的更多相关文章

Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 34865   Accepted: 11192 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 DescriptionFreddy 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 swimm…
https://vjudge.net/problem/POJ-2253 题意 公青蛙想到母青蛙那里去,期间有许多石头,公青蛙可以通过这些石头跳过去.问至少要跳的最大距离,即所有路径上石头间的最大距离的最小值. 分析 这题是最短路的变形,最短路求的是路径总长的最小值,而此题是求通路中最长边的最小值.其实就是对最短路的定义不同: 一般的最短路为“每个边的权值之和”,这个题的最短路为 “各个边的权值的最大值”.注意格式输出,G++用%f. #include<iostream> #include<…
题目链接 http://poj.org/problem?id=2253 题意 给出青蛙A,B和若干石头的坐标,现在青蛙A要跳到青蛙B所在的石头上,求出所有路径中最远那一跳的最小值. 思路 Floyd算法的变形,将求两点之间的最短路改成求两点之间最大边权的最小值即可. 代码 #include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include <cma…
题目链接:http://poj.org/problem?id=2253 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 49409   Accepted: 15729 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on a…
题目链接:https://cn.vjudge.net/problem/POJ-2253 题意 一只Forg需要从节点1走到节点n 现要找一条各个间隔最小的路径 问间隔最小是多少 思路 用dijsktra就好 查找间隔最小的路径 注意浮点数的比较 代码 #include <cstdio> #include <vector> #include <queue> #include <cmath> using namespace std; const int maxn…
/* 题意:就是源点到终点有多条的路径,每一条路径中都有一段最大的距离! 求这些路径中最大距离的最小值! Dijkstra, Floyd, spfa都是可以的!只不过是将松弛的条件变一下就行了! 想了一下,这道题用最小生成树做也可以啊,图总是连通的嘛!所以建一棵最小 生成树,然后dfs一下,从源点1,到终点2的路径上,查找边长最大的路径! 附上代码..... */ #include<iostream> #include<cstdio> #include<algorithm&g…
题目链接. 题意: 从0号点,到1号点,找一条能通过的路,使得这条路中的最大的边,比其它所有可能的路中的边都小. 分析: 这题就是按着dijkstra写,写着写着觉得像是prim了. 其中d[n]表示从0出发到达该点的某条路中的最大边,且比其它可能的路中的都小. 从d[i]到d[j], 就是要用 max(d[i], G[i][j]) 去更新 d[j] . 注意: 输出时要用 %.3f 不能用 %.3lf. #include <iostream> #include <cstdio>…
题目链接:http://poj.org/problem?id=2253 就是求所有路径的最大边权值的最小值 处理时每次找出距离当前的已选的节点的最短距离,然后更新每个未选节点的值 代码: #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<cmath> using namespace std; #define maxn 210 #defi…
做到了这个题,感觉网上的博客是真的水,只有kuangbin大神一句话就点醒了我,所以我写这篇博客是为了让最短路的入门者尽快脱坑...... 本题思路:本题是最短路的变形,要求出最短路中的最大跳跃距离,基本思路与最短路一样,dist数组为当前点到源结点最短路的最大距离,这样的话我们知道只需要改变松弛方程就可以了,每次我们选取一个最小值dist[ k ],那么接下来我们就需要将与结点k相邻的结点都更新,如何更新呢,当然是选取之前所走路中的最大值和现在需要走的路中的值的最大值啦即dist[ j ] =…