MPI Maelstrom POJ - 1502 floyd
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
const int N=;
const int INF = 0x3f3f3f3f;
char s[];
int n;
int f[N][N];
void init()
{
for(int i = ; i <= n ; i++)
for(int j = ; j <= n ; j++)
if(i == j)
f[i][j] = ;
else
f[i][j] = INF ; }
void floyd()
{
for(int k = ; k <= n ; k++)
for(int i = ; i <= n ; i++)
for(int j = ; j <= n ; j++)
f[i][j] = min(f[i][j],f[i][k] +f[k][j]);
int ans = -INF ;
for(int i = ; i <= n ; i++)
if(f[][i] !=INF)
ans = max(ans,f[][i]);
cout<<ans<<endl;
}
int main()
{
cin>>n;
init();
for(int i = ; i <= n ; i++)
for(int j = ; j < i; j++)
{
cin>>s;
if(s[]!= 'x')
{
int num = atoi(s);
f[i][j] = f[j][i] = num;
}
}
floyd();
return ;
}
MPI Maelstrom POJ - 1502 floyd的更多相关文章
- kuangbin专题专题四 MPI Maelstrom POJ - 1502
题目链接:https://vjudge.net/problem/POJ-1502 dijkstra板子题,题目提供下三角情况,不包含正对角线,因为有题意都为0,处理好输入,就是一个很水的题. #inc ...
- POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径)
POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom ...
- POJ 1502 MPI Maelstrom (最短路)
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6044 Accepted: 3761 Des ...
- POJ 1502 MPI Maelstrom(最短路)
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4017 Accepted: 2412 Des ...
- POJ 1502 MPI Maelstrom
MPI Maelstrom Time Limit : 2000/1000ms (Java/Other) Memory Limit : 20000/10000K (Java/Other) Total ...
- POJ - 1502 MPI Maelstrom 路径传输Dij+sscanf(字符串转数字)
MPI Maelstrom BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odys ...
- POJ 1502 MPI Maelstrom [最短路 Dijkstra]
传送门 MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5711 Accepted: 3552 ...
- POJ 1502:MPI Maelstrom Dijkstra模板题
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6499 Accepted: 4036 Des ...
- POJ 1052 MPI Maelstrom
MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5547 Accepted: 3458 Des ...
随机推荐
- 理解设备像素、设备独立像素、css像素、viewport
设备像素也叫物理像素. 设备像素指的是显示器上的真实像素,每个像素的大小是屏幕固有的属性,屏幕出厂以后就不会改变了. 设备分辨率描述的就是这个显示器的宽和高分别是多少个设备像素. 设备像素和设备分辨率 ...
- ElasticSearch集群-Windows
概述 ES集群是一个P2类型的分布式系统,除了集群状态管理以外,其他所有的请求都可以发送到集群内任意一台节点上,这个节点可以自己找到需要转发给哪些节点,并且直接跟这些节点通信.所以,从网络架构及服务配 ...
- leetcode--js--Median of Two Sorted Arrays
问题描述: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of ...
- java 开发社区蔬菜、食品交易平台系统 源码
开发环境: Windows操作系统开发工具: MyEclipse+Jdk+Tomcat+Mysql数据库 运行效果图 源码及原文链接:https://javadao.xyz/forum.php? ...
- net start MySQL57 MySQL57 服务正在启动 . MySQL57 服务无法启动。
造成这种情况的原因有很多,如果直接百度错误信息的话,不一定能很快解决问题,所以,出现这种情况,我们可以使用 mysqld --console 命令来查看报错信息,然后根据报错信息来百度,这样就很快定位 ...
- C#实现的Table的Merge,以及实现Table的Copy和Clone
C#实现的对两个Table进行Merge,两表必须存在至少一个公共栏位作为连接项,否则连接就失去了意义.如下是对两个table进行Merge的详细代码: private void button1_Cl ...
- R语言矩阵维度“消失”的问题
矩阵(matrix)是R语言中很基础的一种数据结构,也是R语言使用者经常使用的一种数据结构.矩阵的维度一般为二维(m*n). R语言中矩阵的操作是非常简单易懂的,但是在对R语言做矩阵操作时,有个地方需 ...
- Bounce 弹飞绵羊 HYSBZ - 2002 分块
//预处理出以这个点为起点并跳出这个块的次数和位置 //更新一个点的弹力系数可以只更新这个点以及这个块内之前的点 #include<stdio.h> #include<algorit ...
- css基础-盒子模型+背景和列表
border-style的值: none 无 dotted 点状 dashed 虚线 solid 实线 double 双实线 margin: 垂直方向两个相邻元素都设置了外边距,那么外边距会发生合并 ...
- html页面提交JSON,ASP页面接收并打印
jsonSubmit.html 1)能过 javascript函数驱动请求页 <!DOCTYPE html> <html> <head> <title> ...