我没实力。
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 105;
int n,m,st,en,u,v,c,t,cmin[N][N * N],ans,minn = INT_MAX;
bool vis[N];
struct edge{int v,c,t;};
vector<edge> g[N];
queue<int> q;
void spfa(int s){
memset(cmin,0x7f,sizeof(cmin));
q.push(s);for(int i = 1;i <= 10000;i++)cmin[st][i] = 0;vis[s] = true;
while(!q.empty()){
int u = q.front();q.pop();vis[s] = false;
for(int i = 0;i < g[u].size();i++){
int v = g[u][i].v,c = g[u][i].c,t = g[u][i].t;
for(int j = 0;j <= 10000 - c;j++){
if(cmin[u][j] + t < cmin[v][c + j]){
cmin[v][c + j] = cmin[u][j] + t;
if(!vis[v])q.push(v),vis[v] = true;
}
}
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> st >> en;
for(int i = 1;i <= m;i++)cin >> u >> v >> c >> t,g[u].push_back({v,c,t}),g[v].push_back({u,c,t});
spfa(st);
for(int j = 0;j <= 10000;j++){
if(cmin[en][j] >= minn)continue;
minn = cmin[en][j];
ans++;
}
cout << ans;
}