POJ-2253 Frogger (Dijkstra)

CST微波工作室端口设置保姆级教程:从波导端口到离散端口,手把手教你搞定S参数仿真 本文提供CST微波工作室端口设置的详细教程,涵盖波导端口和离散端口的选择与配置,助力工程师精准完成S参数仿真。通过微带线滤波器案例,详解端口尺寸、阻抗设置及常见问题排查,提升仿真效率与准确性。 阅读详情

. 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 reach her by
jumping.
Unfortunately Fiona’s stone is out of his jump range. Therefore Freddy considers to use other stones as intermediate stops and reach
her by a sequence of several small jumps.
To execute a given sequence of jumps, a frog’s jump range obviously must be at least as long as the longest jump occuring in
the sequence.
The frog distance (humans also call it minimax distance) between two stones therefore is defined as the minimum necessary jump range
over all possible paths between the two stones.
You are given the coordinates of Freddy’s stone, Fiona’s stone and all other stones in the lake. Your job is to compute the frog
distance between Freddy’s and Fiona’s stone.

Input
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 contain two integers xi,yi (0 <= xi,yi <= 1000) representing the coordinates of stone #i. Stone #1 is Freddy’s stone, stone #2 is Fiona’s stone, the other n-2 stones are unoccupied. There’s a blank line following each test case. Input is terminated by a value of zero (0) for n.
Output
For each test case, print a line saying “Scenario #x” and a line saying “Frog Distance = y” where x is replaced by the test case number (they are numbered from 1) and y is replaced by the appropriate real number, printed to three decimals. Put a blank line after each test case, even after the last one.
Sample Input

2
0 0
3 4

3
17 4
19 4
18 5

0

Sample Output

Scenario #1
Frog Distance = 5.000

Scenario #2
Frog Distance = 1.414

/*题意描述:给出n个坐标第一个代表第一个青蛙第二个坐标代表第二个青蛙,其它坐标为其它的石头,现在第一个青蛙要去第二个哪里问最短的蛙距是多少。这里千万不要理解为是第一个青蛙到第二个青蛙的最短路径。这个是第一个青蛙到第二青蛙所有路线中的,某一段的最短距离。呵呵说了这么多的废话下边看代码吧!

#include<stdio.h>
#include<string.h>
#include<math.h>

struct node
{
	int x,y;
}p[210];

double max(double a,double b)
{
	if(a>b)
		return a;
	else
		return b;
}

int main(void)
{
	double inf=99999999;
	int book[210];
	double e[210][210],dis[210],min;
	int n,i,j,u;
	int t=1;
	while(~scanf("%d",&n))
	{
		if(n==0)
			break;
		for(i=1;i<=n;i++)
			for(j=1;j<=n;j++)
				if(i==j) e[i][j]=0;
				else e[i][j]=inf;
		
		 for(i=1;i<=n;i++)
		 		scanf("%d%d",&p[i].x,&p[i].y);
		if(n==2)
			printf("Scenario #%d\nFrog Distance = %.3lf\n\n",t++,(double)sqrt((p[1].x-p[2].x)*(p[1].x-p[2].x)+(p[1].y-p[2].y)*(p[1].y-p[2].y)));
		else
		{
			int k;
			for(i=1;i<=n;i++)
				for(j=i+1;j<=n;j++)
					e[j][i]=e[i][j]=(double)sqrt((p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y));
			for(i=1;i<=n;i++)
				dis[i]=e[1][i];	
			memset(book,0,sizeof(book));
			book[1]=1;
			for(i=1;i<n;i++)
			{
				min=inf;
				for(j=1;j<=n;j++)
				{
					if(book[j]==0&&dis[j]<min)
					{
						min=dis[j];
						u=j;
					}
				}
				book[u]=1;
				for(k=1;k<=n;k++)
					if(book[k]==0)
					{
						if(dis[k]>max(dis[u],e[u][k]))
							dis[k]=max(dis[u],e[u][k]);
					}
			}
			printf("Scenario #%d\nFrog Distance = %.3lf\n\n",t++,dis[2]);
		}
	}
	return 0;	
}

AI上推荐 之 NeuralCF与PNN模型(改变特征交叉方式) 1. 前言 随着信息技术和互联网的发展, 我们已经步入了一个信息过载的时代,这个时代,无论是信息消费者还是信息生产者都遇到了很大的挑战: 信息消费者:如何从大量的信息中找到自己感兴趣的信息? 信息生产者:如何让自己生产的信息脱颖而出, 受到广大用户的关注? 为了解决这个矛盾, 推荐系统应时而生, 并飞速前进,在用户和信息之间架起了一道桥梁,一方面帮助用户发现对自己有价值的信息, 一方面让信息能够展现在对它感兴趣的用户前面。 推荐系统近几年有了深度学习的助推发展之势迅猛, 从前深度学习的传统推荐模型(协 阅读详情

相关推荐

华为HCIA-Datacom实战:200人企业园区网从规划到部署全流程解析

本文详细解析了华为HCIA-Datacom认证实战中200人企业园区网的规划与部署全流程。从需求分析、组网架构设计到设备选型、VLAN划分及安全策略实施,全面覆盖园区网建设的关键环节,特别针对部门隔离、无线覆盖和基础安全防护等典型场景提供可落地的解决方案。

f0g1h2的博客 710

POJ 2253 Frogger简单Dijkstra算法实现

Frogger poj 2253 一定要看清题目的要求 湖中有n块石头,编号从1到n,有两只青蛙,Bob在1号石头上,Alice在2号石头上,Bob想去看望Alice,但由于水很脏,他想避免游泳,于是跳着去找她。但是Alice的石头超出了他的跳跃范围。因此,Bob使用其他石头作为中间站,通过一系列的小跳跃到达她。两块石头之间的青蛙距离被定义为两块石头之间所有可能路径上的最小必要跳跃距离,某条路径...

a1055180117的博客 315

python爬取《你好, 李焕英》豆瓣评论数据

# 导入工具包 import requests from bs4 import BeautifulSoup import time import pandas as pd import numpy as np # 请求头 headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36'} # =

python技巧分享 3456

POJ. 2253 Frogger (Dijkstra )

POJ. 2253 Frogger (Dijkstra )题意分析 首先给出n个点的坐标,其中第一个点的坐标为青蛙1的坐标,第二个点的坐标为青蛙2的坐标。给出的n个点,两两双向互通,求出由1到2可行通路的所有步骤当中,步长最大值。 在dij原算法的基础上稍作改动即可。dij求解的是单源最短路,现在求解的是步长最大值,那么更新原则就是,当前的这一步比保存的步如果要大的话,就更新,否则就不更新。 如此求

Pengwill's Blog 313

告别游戏卡关!用Cheat Engine 7.5修改单机游戏数据的保姆级教程(附Tutorial靶场练习)

本文提供了一份详细的Cheat Engine 7.5使用教程,帮助玩家轻松修改单机游戏数据。从基础操作到高级技巧,包括精确值扫描、模糊扫描、指针扫描和代码注入,教程还涵盖了《植物大战僵尸》和《星露谷物语》的实战案例,确保玩家能够安全、高效地优化游戏体验。

weixin_30082367的博客 782

海思方案定制hi3531dv200/SS528 DVR方案解析:从硬件选型到编解码实战应用

海思方案,Hi3518EV100,Hi3518CV100,Hi3515CV100,Hi3516CV100,Hi3516ECV100,Hi3516D,Hi3516A,Hi3519,Hi3520D,Hi3521A,Hi3535,Hi3531,Hi3536,Hi3536C,Hi3536D,Hi3518EV200,Hi3518EV201,Hi3520DV200,Hi3516CV200,Hi3516CV300,Hi3516AV200,Hi3520DV300,Hi3519V101,sd3403,hi3519av200

1585

POJ2253 Frogger (dijkstra)

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

邵光亮的博客 13万+

【人脸识别】基于 Gabor+SVM和PCA+SVM实现人脸识别matlab源码含 GUI

1 简介 随着经济的快速发展,互联网的普及,信息安全逐渐被人们所重视。人脸识别技术作为保护信息安全的重要手段之一,也逐渐被研究学者所重视。人脸识别作为计算机视觉技术和生物特征识别技术的一个重要分支,模式识别与人工智能的一个重要领域,其主要任务是对静态图像或动态视频进行识别。如何快速的正确的对人脸进行识别是目前人脸识别课题的一个难题。人脸识别算法的选取直接关系到人脸识别的识别率。 本文首先介绍了国内外人脸识别的发展现状,并对人脸图像预处理方法进行了详细阐述。图像预处理的方法有很多,主要包括:灰度变换、图像锐

qq_59747472的博客 1136

poj 2253 Frogger [dijkstra]

传送门:http://poj.org/problem?id=2253 Frogger 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 v

code_or_code 841

(八)DDR_PHY架构及功能——(PUB组成、初始化及Training流程、Clock关系)

文章目录一、DDR_PHY结构组成1.1、DDR Memory子系统1.2、DDR_PHY架构组成1.3、PUB模块功能实现流程1.3.1、DDR系统初始化流程1.3.2、PLL初始化流程 一、DDR_PHY结构组成 1.1、DDR Memory子系统   Memory子系统主要由DDR Controller和DDR_PHY(含DDR_IO)两个部分组成。DDR Controller主要承担其它子系统(如CPU)与Memory子系统进行数据交互时的传输效率及调度,DDR_PHY主要负责数据交互过程中的传输速

Mr.翟的博客 1万+

群辉NAS映射为本地盘符

鼠标右击网络→映射网络驱动器→以上适合通过局域网操作,采用ZeroTier组网后,也可以按照以上步骤实现,这时使用 “虚拟局域网”的IP地址。

dgnankai的专栏 5774

POJ2253 UVA534 ZOJ1942 Frogger【Dijkstra算法】

Frogger Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 83568 Accepted: 25315 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 sin

海岛Blog 805

Linux ARM平台开发系列讲解(LED) 2.1.1 如何点亮一个LED之添加设备树信息

1. 设备树添加设备信息 我拿到的开发板上有两颗LED供用户编程使用,分别是GPIO5_IO8和GPIO5_IO9,设备信息如下,不同板子的设备定义不同,根据自己的实际情况进行添加。 2. 编译设备树 根据自己拿到的SDK,执行编译命令,我这里拿到的SDK编译脚本为: ./build.sh kernel 3. 使用uuu工具烧录新编译好的内核 因为imx8 SDK设备树和内核是统一编译成一个镜像,所以只需要烧录内核,设备树文件也会烧录。 sudo uuu -b emmc imx-kernel.bin

DSMGUOGUO的博客 918

poj 2253 Frogger 【dijkstra】

Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 41336   Accepted: 13260 Description Freddy Frog is sitting on a stone in the middle of a lake. Sudd

逝去的时光 243

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

POJ 2253 Frogger (最短距离,dijkstra,裸题)

题目意思: 一只青蛙从1号石头跳到2号石头,不能直接跳过去,需要借助其他的石头来跳, 求从1号石头到2号石头所有路径中的最大跳跃距离的最小值。 本题要点: 1、单源最短路径,dijkstra算法,裸题。 2、题目的点事以 坐标的形式给出,求出每两点之间的额距离,然后用 dijkstra 算法求出,以1 点为起点,终点是 2 点的最短距离 d[2]。注意,这里的最短距离,指的是路径上最大跳跃距离的最小值, 只需在原来的dijkstra 算法的代码改改即可。 #include <cstdio> #i

qq_38232157的博客 213

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Frogger poj 2253 dijkstra

Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 39419   Accepted: 12682 Description Freddy Frog is sitting on a stone in the middle of a lake. Sudden

Believe in the Future的专栏 440

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

poj2253 Frogger(dijkstra)

Frogger Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 72072 Accepted: 22081 Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is ...

weixin_43736492的博客 270

POJ 2253 Frogger dijkstra

就是从某点到某点找一条路径,使得这条路径上的最长的长度最短 这个问题,跟最短路的性质类似,所以也可以这样去搞, if (!vis[j] && max(dist[k], graph[k][j])    {     dist[j] = max(dist[k], graph[k][j]);     //path[j] = k;    } 就是dist[j]存储从出发点到该点的路径上的最长

一蓑烟雨任平生 323

POJ2253 Frogger 【Dijkstra】

Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26417   Accepted: 8592 Description Freddy Frog is sitting on a stone in the middle of a lake. Sudde

长风的专栏 1103

POJ2253 Frogger【Dijkstra】

Frogger 题意: 给定一个无向图,求到达2号点的路径中(不要求最短),边权最大值最小。 #include<algorithm> #include<iostream> #include<cmath> #include<queue> using namespace std; #define _for(i, a, b) for(int i = (a); i <= (b); ++i) typedef long long ll; const...

lllllan 161

POJ2253:Frogger(改造Dijkstra)

Frogger Time Limit:1000MS Memory Limit:65536K Total Submissions:64864 Accepted:20127 题目链接:http://poj.org/problem?id=2253 Description: Freddy Frog is sitting on a ...

dft539533的博客 109

POJ 2253 Frogger(dijkstra最短路)

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

fvbdk的博客 175

[POJ 2253][最短路dijkstra]Frogger

Frogger【POJ 2253】 【最短路dijkstra】

HIT_Zero的博客 402

poj 2253 Frogger(dijkstra)

http://poj.org/problem?id=2253 Frogger Time Limit:1000MS Memory Limit:65536K Total Submissions:20262 Accepted:6575 Description Freddy Frog is sitting on a sto...

diansitao5461的博客 92

poj 2253 Frogger dijkstra算法实现

点击打开链接 Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21653   Accepted: 7042 Description Freddy Frog is sitting on a stone in the middle of a

云淡风清 725

poj 2253 Frogger (Dijkstra)

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

long_xuan的博客 153
上一篇: POJ 2243 Knight Moves bfs
下一篇: POJ1502 - MPI Maelstrom
鳳九~
博客等级 码龄8年 1384粉丝 215原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值