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]尽 ...
随机推荐
- vue案例 - 使用vue实现自定义多选与单选的答题功能
4月底立得flag,五月底插上小旗,结果拖到六月底七月初才来执行.说什么工作忙都是借口,就是睡的比猪早,起的比猪晚. 本来实现多选单选这个功能,vue组件中在表单方面提供了一个v-model指令,非常 ...
- JSON类库 Flexjson学习
官方地址(需FQ):http://flexjson.sourceforge.net/ Flexjson 是一个将 Java 对象转成 JSON 的 类库,是一个深度转换的过程. 下面是我写的一个例子: ...
- adb 查看内存信息的命令
meminfo: basic memory status-adb shell cat proc/meminfo -- 内存系统信息-adb shell cat proc/pid/maps -- 指 ...
- windows 电脑配置信息检测
内存条 DDR4 DDR4相比DDR3最大的区别有: 1)处理器:每次内存升级换代时,必须支持的就是处理器.Haswell-E平台的内存同IVB-E/SNB-E一样为四通道设计,DDR4内存频率原生支 ...
- sencha touch 在视图中显示一个html页面
Ext.define('app.view.about.About', { alternateClassName: 'about', extend: 'Ext.Container', xtype: 'a ...
- Jrebel不生效的原因和解决办法
一.问题原因和解决办法 我这里用的是idea,装了jrebel.之前用的好好的. 后边新建了一个project,不知道为啥,感觉总是不生效,虽然显示class reload了,但感觉还是没起作用. 后 ...
- VC++组合框——学习笔记1(组合框选项的添加和无法显示下拉选项)
VC++控件 ---组合框 环境VC2003 1.组合框添加下拉菜单选项 现在有尝试了两个命令 (m_com为组合框控control类型的变量.) 方法一 m_com.AddString(&qu ...
- iOS - View的抖动效果
/** * 抖动效果 * * @param view 要抖动的view */ - (void)shakeAnimationForView:(UIView *) view { CALayer *view ...
- springMVC访问 WEB-INF 下的 jsp 和 html
配置freemarker,记得加上jar包 <?xml version="1.0" encoding="UTF-8"?> <beans xml ...
- Docker logs 命令
[root@docker01 ~]# docker logs --help Usage: docker logs [OPTIONS] CONTAINER Fetch the logs of a con ...