# Problema 1/ 02 martie

Mar 2nd, 2021
819
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include<iostream>
2. using namespace std;
3. int a[21][21],sw;
4. int b[21][21],n;
5.  void royfoyd()
6. { for(int k=1;k<=n;k++)
7.       for(int i=1;i<=n;i++)
8.           for(int j=1;j<=n;j++)
9.               if(b[i][j]&&b[k][j])
10.                  b[i][j]=1;
11. }
12. int circuit()
13. {
14.      for(int i=1;i<=n;i++)
15.         if(b[i][i])
16.             return 1;
17.      return 0;
18. }
19. int turneu()
20. {
21.       for(int i=1;i<=n;i++)
22.          for(int j=1;j<=n;j++)
23.             if(i!=j && a[i][j] +a[i][j]==0)
24.               return 0;
25.       return 1;
26. }
27. int main()
28. {
29.     cin>>n;
30.     for(int i=1;i<=n;i++)
31.         for(int j=1;j<=n;j++)
32.         {
33.             cin>>a[i][j];
34.             b[i][j]=a[i][j];
35.         }
36.     royfloyd();
37.
38.     cout<<"a) ";
39.     if(circuit()) cout<<"graful are circuite\n";
40.     else cout<<"graful nu are circuite\n";
41.
42.     cout<<"b) nu exista drum intre:\n";
43.     for(int i=1;i<=n;i++)
44.         for(int j=1;j<=n;j++)
45.             if(i!=j && !b[i][j])
46.                 cout<<i<<' '<<j<<'\n';
47.
48.     cout<<"c) ";
49.     if(turneu()) cout<<"graful este turneu\n";
50.     else cout<<"graful nu este turneu\n";
51.
52.     cout<<"d) ";
53.     if(complet()) cout<<"graful este complet\n";
54.     else cout<<"graful nu este complet\n";
55.     return 0;
56. }
RAW Paste Data

# Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×