刚做淘客没有网站,标书制作员是干什么的,天津网站优化哪家最专业,产品设计经典案例题意#xff1a;题目给出了m对的相对关系#xff0c;求有多少个排名是确定的。 链接#xff1a;点我 如果这个点到其他点的关系是确定的#xff0c;那么这个点就是确定的#xff0c;注意如果这个点到不了其他点#xff0c;但其他点能到这个点#xff0c;那么这个点和其他…题意题目给出了m对的相对关系求有多少个排名是确定的。 链接点我 如果这个点到其他点的关系是确定的那么这个点就是确定的注意如果这个点到不了其他点但其他点能到这个点那么这个点和其他点的关系是确定的 样例图 1 #includecstdio2 #includeiostream3 #includealgorithm4 #includecstring5 #includecmath6 #includequeue7 #includemap8 using namespace std;9 #define MOD 1000000007
10 #define pb(a) push_back(a)
11 const int INF0x3f3f3f3f;
12 const double eps1e-5;
13 typedef long long ll;
14 #define cl(a) memset(a,0,sizeof(a))
15 #define ts printf(*****\n);
16 const int MAXN110;
17 int n,m,tt,cnt;
18 int g[MAXN][MAXN];
19 int main()
20 {
21 int i,j,k;
22 #ifndef ONLINE_JUDGE
23 freopen(1.in,r,stdin);
24 #endif
25 while(scanf(%d%d,n,m)!EOF)
26 {
27 int a,b;
28 cl(g);
29 for(i0;im;i)
30 {
31 scanf(%d%d,a,b);
32 g[a][b]1;
33 }
34 for(k1;kn;k)
35 for(i1;in;i)
36 for(j1;jn;j)
37 if(g[i][k]1g[k][j]1) g[i][j]1;
38 int tot0;
39 for(i1;in;i)
40 {
41 bool flag1;
42 for(j1;jn;j)
43 {
44 if(ij) continue;
45 if(g[i][j]0g[j][i]0)
46 {
47 flag0;
48 break;
49 }
50 }
51 if(flag)
52 {
53 tot;
54 }
55 }
56 printf(%d\n,tot);
57 }
58 } 转载于:https://www.cnblogs.com/cnblogs321114287/p/4590269.html