MPI Maelstrom poj 1502 单源最短路
来源:互联网 发布:传送门骑士游数据错误 编辑:程序博客网 时间:2024/06/01 09:32
题目大意
求从点1到其他点最短路的最大值。(额)
分析
随便写
c++的字符串~
c++的数组从零开始的异世界
code
#include<iostream>#include<cstring>#include<cstdio>#include<cstdlib>#include<cmath>#include<algorithm>#define fo(i,a,b) for (int i=a;i<=b;i++)#define dfo(i,a,b) for (int i=a;i>=b;i--)using namespace std;int f[101][101];int n;int main(){ while(scanf("%d",&n)!=EOF) { fo(i,1,n) fo(j,1,n) f[i][j]=1000000; fo(i,2,n) { fo(j,1,i-1) { char a[10]; scanf("%s",&a); if (a[0]!='x') f[i][j]=f[j][i]=atof(a); } } fo(k,1,n) fo(i,1,n) fo(j,1,n) if ((i!=j)&&(i!=k)&&(j!=k)) if (f[i][j]>f[i][k]+f[k][j]) f[i][j]=f[i][k]+f[k][j]; int num=0; fo(j,1,n) { if (1==j) continue; num=max(num,f[1][j]); } printf("%d\n",num); }}
1 0
- POJ 1502 - MPI Maelstrom(单源最短路)
- POJ 1502 MPI Maelstrom(单源最短路)
- POJ 1502 - MPI Maelstrom(单源最短路)
- MPI Maelstrom poj 1502 单源最短路
- POJ 1502 MPI Maelstrom(单源最短路|Dijkstra实现)
- POJ 1502 MPI Maelstrom(单源最短路|Floyd实现)
- poj 1502 MPI Maelstrom(单源最短路dijkstra)
- POJ 1502 MPI Maelstrom 单源最短路 Floyd Dijkstra
- POJ 1502 MPI Maelstrom 【单源最短路中求最大值】
- poj 1502 MPI Maelstrom 单源最短路+dijkstra算法
- POJ 1502 MPI Maelstrom 最短路dijkstra
- poj 1502--MPI Maelstrom (最短路spfa)
- 【POJ】1502 MPI Maelstrom 最短路
- POJ 1502 MPI Maelstrom(最短路)
- POJ 1502 MPI Maelstrom 最短路
- POJ 1502MPI Maelstrom BFS最短路
- poj 1502 MPI Maelstrom(最短路)
- 最短路spfa POJ 1502 MPI Maelstrom
- CodeForces742b
- jQuery的选择器(四)
- Oracle Database之数据表连接
- 查询区间小于x的个数,不修改
- 安装Docker管理图形管理工具Shipyard
- MPI Maelstrom poj 1502 单源最短路
- 51nod 1383 整数分解为2的幂
- Oracle Database之集合操作函数(UNION, INTERSECT, MINUS)
- 第十五周项目1-(3)希尔排序
- HDU - 1253
- 某年某天我是否会遇见你
- js/jquery/html前端开发常用到代码片段
- 我的一个c语言程序,践行!
- Android利用productFlavors 打包不同版本API的调用