hdu 1596 find the safest road
来源:互联网 发布:荔枝网络电视直播 编辑:程序博客网 时间:2024/05/24 01:35
#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;double map[1100][1100];void floyd(int n){int i,j,k;for(k=1;k<=n;k++)for(i=1;i<=n;i++)for(j=1;j<=n;j++){if(map[i][j]<map[i][k]*map[k][j])map[i][j]=map[i][k]*map[k][j];}}int main(){int n;int i,j;while(scanf("%d",&n)!=EOF){for(i=1;i<=n;i++){for(j=1;j<=n;j++){scanf("%lf",&map[i][j]);}}floyd(n);int Q;int a,b;scanf("%d",&Q);for(i=1;i<=Q;i++){scanf("%d%d",&a,&b);if(map[a][b]>0)printf("%.3lf\n",map[a][b]);elseprintf("What a pity!\n");}}}
0 0
- hdu 1596 find the safest road(priority_queue )
- HDU 1596 find the safest road
- HDU-1596 find the safest road
- hdu 1596 find the safest road
- hdu 1596 find the safest road
- HDU-1596-find the safest road
- HDU 1596 find the safest road
- HDU 1596 find the safest road
- hdu 1596find the safest road--dijkstra
- hdu 1596 find the safest road
- hdu 1596 find the safest road
- hdu 1596 find the safest road
- HDU 1596 find the safest road
- hdu 1596 find the safest road
- hdu 1596 find the safest road
- hdu-1596 find the safest road
- HDU 1596 find the safest road(Dijkstra)
- HDU 1596 find the safest road
- [BZOJ1296][SCOI2009]粉刷匠
- css3.动画
- Ubuntu 安装mysql和简单操作
- Mybatis系列(四)映射文件
- 黑马程序员————JAVA之正则表达式
- hdu 1596 find the safest road
- getApplicationContext()、Activity.this、 getBaseContext区别
- 集群中使用
- css3.弹性盒子
- 顺序栈—括号匹配
- NSNumber转NSString:
- 访问者模式
- 【Python】菜鸟学习笔记(3)数字
- 某某2016笔试题