链接
题目描述
给出一个无向图,起点s ,终点e ,t 条边和一个正整数n ,求从 s 到 e 走过 n 条边的最短路径长度。
思路
把乘法那段修改成取最小值(类似于floyd
然后直接跑矩阵乘法
代码
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int n, t, s, e, numm, num[1000005];
struct matrix
{
int a[105][105];
}g, Ans;
matrix operator *(matrix a