标签:tor size using pre tps name ++ ble https
链接:https://pintia.cn/problem-sets/994805046380707840/problems/1336215880692482060
思路:
代码:
#include<bits/stdc++.h>
using namespace std;
vector<int>ve[1005];
int vis[1005];
int num[1005];
int n,m,s,d;
int dfs(int x){
vis[x]=1;
if(num[x])return num[x];
for(int i=0;i<ve[x].size();i++)
num[x]+=dfs(ve[x][i]);
return num[x];
}
int main (){
cin>>n>>m;
int l,r;
for(int i=0;i<m;i++){
cin>>l>>r;
ve[l].push_back(r);
}
cin>>s>>d;
num[d]=1;
int cnt=dfs(s);
cout<<cnt;
for(int i=1;i<=n;i++){
if(vis[i]&&num[i]==0){
cout<<" No";
return 0;
}
}
cout<<" Yes";
return 0;
}
标签:tor size using pre tps name ++ ble https
原文地址:https://www.cnblogs.com/abestxun/p/14695265.html