HDU 1596 find the safest road
来源:互联网 发布:少儿编程培训机构地址 编辑:程序博客网 时间:2024/05/17 01:35
用floyd水之,注意格式问题
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define N 1005double w[N][N];int main(){ int n; while(scanf("%d",&n)!=EOF) { int i,j,k; double v; for(i=1; i<=n; i++) { for(j=1; j<=n; j++) { scanf("%lf",&v); w[i][j]=v; } } for(k=1;k<=n;k++) { for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { w[i][j]=max(w[i][j],w[i][k]*w[k][j]); } } } int r,a,b; scanf("%d",&r); for(i=0;i<r;i++) { scanf("%d%d",&a,&b); if(!w[a][b]) { printf("What a pity!\n"); } else { printf("%0.3lf\n",w[a][b]); } } } return 0;}
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
- 人脸性别识别文献阅读笔记(3)
- BCB 报错 BORLNDMM.DLL has already allcated memory
- div动态设置样式
- app在小米4上的图标是机器人
- 我的博客之路》》》开始之代码运行时间和cocoapods用法
- HDU 1596 find the safest road
- ASCII码表
- hello world
- 解决android中viewpager自动占满父控件的问题
- Windows下TexLive2015 TeXstudio 和SumatraPDF安装配置
- axis2 weibservice 入门
- TQ2440 学习笔记—— 13、GPIO 接口【实验:用汇编语言实现】
- 研究传销骗局
- Android 打造形形色色的进度条 实现可以如此简单