luqyou @ 2022-10-17 17:01:08
#include<bits/stdc++.h>
using namespace std;
int a,b,f[11][11],n=3;
int main(){
memset(f,0x3f,sizeof(f));
scanf("%d%d",&a,&b);
f[1][2]=a;
f[1][1]=0;
f[2][1]=a;
f[2][2]=0;
f[3][2]=b;
f[2][3]=b;
f[3][3]=0;
for(int k=1;k<=n;k++){
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
}
}
}
printf("%d",f[1][3]);
return 0;
}
by _Virgo_ @ 2022-10-17 17:07:40
@luqyou hack:
-1 -1
你的输出:
-14
by luqyou @ 2022-10-17 17:09:19
@ly_潘烨 我知道啊,但不知道哪里错了
by _Virgo_ @ 2022-10-17 17:09:28
@luqyou 你的代码好像
by luqyou @ 2022-10-17 17:09:38
@ly_潘烨 这玩意遇到负数就挂
by _Virgo_ @ 2022-10-17 17:10:10
给我点时间
by Usada_Pekora @ 2022-10-17 17:15:54
@luqyou 负环。
by Usada_Pekora @ 2022-10-17 17:17:47
还有 inf
太小了,
by ttq012 @ 2022-10-17 17:18:02
@luqyou 输入数据 -2 3
by _Virgo_ @ 2022-10-17 17:18:31
@Zyingyzzz %%%
by _Virgo_ @ 2022-10-17 17:18:48
没想到负环