本文主要是介绍EL PSY CONGROO,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
加粗样式
#include <bits/stdc++.h>
using namespace std;
int mod = 98319;
vector<int> edge[100500];
int vis[100500];
int rcd[100500];
bool flag;
int solve(int st, int ed)
{if (st == ed){return flag = 1;}else {if (vis[st] == 1) return rcd[st];if (vis[st] == -1) return 0; vis[st] = -1;int ans = 0;for (int i=0; i<edge[st].size(); ++i) {ans += solve(edge[st][i], ed)%mod;ans %= mod;}vis[st] = 1;rcd[st] = ans;return rcd[st];}return 0;
}int main()
{int n, m, a, b;cin >> n >> m >> a >> b;int i;int x, y;for (i=0; i<m; ++i) {cin >> x >> y;edge[x].push_back(y);}int ans = solve(a, b);if (flag) cout << ans;else cout << "TAT" << endl;return 0;
}
这篇关于EL PSY CONGROO的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!