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 ...
随机推荐
- LINQ标准查询运算符的执行方式-即时
即时,声明查询的位置立即执行.查询返回如果是不可以枚举的的结果,都会立即执行. 执行方式为“”即时”的查询运算符有下面这些. Aggregate 应用累计器函数和结果选择器,返回传入泛型类型TSour ...
- 让$(window).scroll()监听事件只执行一次
可以用jQuery中的unbind()来进行事件解绑. $(window).scroll(function() { console.log("滚离顶部" + $(document) ...
- R语言入门:使用RStudio的基本操作
R语言在人工智能,统计学,机器学习,量化投资,以及生物信息学方面有着十分广泛的运用.也是我大学的必修课,因此这里梳理一些有关R语言的知识点,做做记录. 首先我们需要知道R语言的工作区域,R语言默认的工 ...
- 无人机通信协议MAVLink简介
MAVLink MAVLink(Micro Air Vehicle Link,微型空中飞行器链路通讯协议)是无人飞行器与地面站(Ground Control Station ,GCS)之间通讯,以及无 ...
- 【笔记】机器学习 - 李宏毅 - 6 - Logistic Regression
Logistic Regression 逻辑回归 逻辑回归与线性回归有很多相似的地方.后面会做对比,先将逻辑回归函数可视化一下. 与其所对应的损失函数如下,并将求max转换为min,并转换为求指数形式 ...
- Spark kafka flume
Flume Flume 是一个分布式.可靠.和高可用的海量日志聚合的系统,支持在系统中定制各类数据发送方,通过监控整个文件目录或者某一个特定文件,用于收集数据:同时Flume也 提供数据写到各种数据接 ...
- springboot web - 启动(1) 创建SpringApplication
一. 测试代码 @SpringBootApplication public class SbmvcApplication { public static void main(String[] args ...
- IntelliJ IDEA搭建一个简单的springboot项目
一.IDEA 安装包 百度网盘链接:https://pan.baidu.com/s/1MYgZaBVWXgy64KxnoeJSyg 提取码:7dh2 IDEA注册码获取:http://idea.lan ...
- SQL Server误设置max server memory处理小结
昨天网上一网友说,由于他同事误将"max server memory"设置为10M后,SQL Server数据库登录不了,当时我简单测试了一下,今天有空就顺手将整个过程整理一下,记 ...
- nohup npm start &启动之后关闭终端程序没有后台运行
感谢:https://blog.csdn.net/nsj820/article/details/5862231 “在当shell中提示了nohup成功后,还需要按终端上键盘任意键退回到shell输入命 ...