find the safest road(弗洛伊德)
http://acm.hdu.edu.cn/showproblem.php?pid=1596
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
int n;
int ss,ee;
double map[][];
void F()
{
for(int k=;k<=n;k++)
{
for(int j=;j<=n;j++)
{
for(int i=;i<=n;i++)
{
if(map[j][k]*map[k][i]>map[j][i])
map[j][i]=map[j][k]*map[k][i];
}
}
} }
int main()
{
double t;
int Q;
int x,y;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<=n;i++)
{
for(int j=;j<=n;j++)
{
scanf("%lf",&t);
map[i][j]=t;
}
}
F();
scanf("%d",&Q);
while(Q--)
{
scanf("%d%d",&x,&y);
if(map[x][y]==)
printf("What a pity!\n");
else printf("%.3lf\n",map[x][y]);
}
}
return ;
}
find the safest road(弗洛伊德)的更多相关文章
- 杭电 1595 find the safest road
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- hdoj 1596 find the safest road【最短路变形,求最大安全系数】
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- find the safest road
find the safest road Time Limit : 10000/5000ms (Java/Other) Memory Limit : 32768/32768K (Java/Othe ...
- hdu1569find the safest road(floyd变形求最大安全值)
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU 1596 find the safest road (最短路)
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU1596 find the safest road
find the safest road XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一 ...
- hdu1596find the safest road(floyd)
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- hdu 1596 find the safest road (最短路径)
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU.1596 find the safest road (Floyd)
HDU.1596 find the safest road (Floyd) 题意分析 与普通的最短路不太相同,本题有些许的变化. 1. 要找到由i到j最安全的路,故在求解的时候要保证mp[i][j]尽 ...
随机推荐
- 【EF框架】另一个 SqlParameterCollection 中已包含 SqlParameter。
查询报表的时候需要通过两次查询取出数据. 第一次,用count(*)查出总数: 第二次,用rownumber分页取出想要的页内容: 为了防止sql注入,使用SqlParameter来传递参数 var ...
- 【thinkphp5】使用tp5开发api接口 定义全局异常处理
1 新建文件夹以及文件 路径: /application/lib/exception/ExceptionHandler.php 并键入以下代码 <?php namespace app\lib\e ...
- 【数据库系列】MySql中的select的锁表范围
由于InnoDB预设的是Row-Level Lock,只有明确指定主键的时候MySql才会执行Row lock,否则MySql将会执行Table Lock. 1.明确指定主键则是行锁 2.明确指定主键 ...
- dos 下如何查看环境变量
使用命令:echo %path%
- NC 的高级应用
高级用法: (1)作攻击程序用,例子: 格式1:type.exe c:\exploit.txt|nc -nvv 192.168.x.x 80 格式2:nc -nvv 192.168.x.x 80 &l ...
- 前端代码在线调试&分享网站
1.RunJs 2.CodePen 3.JsFiddle
- Docker 启动 Centos 镜像 提示"Error response from daemon: No command specified"
奇怪的是当我执行启动其他的镜像的时候并没有报错,找了半天资料发现在启动centos这个镜像的时候需要在docker命令后面指定命令参数“/bin/bash”
- python nose测试框架全面介绍九---各种html报告插件对比
一直在使用Nose-html-reporting,并输出html报告,但今天在使用时发出有点问题:于时,将python目前可能的html报告插件下载后进行对比,如下 一.Nose-html-repor ...
- AndroidStudio 使用Release签名进行Debug
extends:http://blog.csdn.net/h3c4lenovo/article/details/42011887 , http://www.linuxidc.com/Linux/201 ...
- dhroid - Perference
SharedPreferences 是我们开发android使用很多的工具通常我们是这样使用的 SharedPreferences share=getSharedPreferences("n ...