#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = l; i <= r; i++)
using db = double;
using ll = long long;
using ull = unsigned long long;
const int INF = 1 << 30;
const long long INFL = 1LL << 60;
int f[124][124];
signed main()
{
memset(f, 0x3f3f3f3f, sizeof(f));
int a,b;
cin>>a>>b;
int n=3;
f[1][2]=f[2][1]=a;
f[2][3]=f[3][2]=b;
rep(k, 1, n)
rep(i, 1, n)
rep(j, 1, n)
f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
cout<<f[1][3];
}
思路是设 u,t,v 然后 w(u,t)=a,w(t,v)=b.然后求最短路.
https://www.luogu.com.cn/record/120564071