摘要:
众所周知,bellman_ford算法最常用的性质是判负环 也可以求最短路,SPFA算法改自Bellman_Ford。 1074 Extended Traffic $(u,v)$的边权是$ (b[v] b[u])^3$,输出从顶点1到各点最短路径,因为存在负环,所以从负环到达的点的最短路是 inf。 阅读全文
摘要:
"题目链接" 暴力枚举结果情况,然后跟当前比较,找到最小次数 C++ include include include using namespace std; int t; char s[1005]; int main() { scanf("%d", &t); while(t ) { scanf(" 阅读全文