SHARE
TWEET

pula

a guest Dec 3rd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a[101][101],n,i,j;
  6.  
  7. int main()
  8. {
  9.     cin>>n;
  10.     bool ok=1;
  11.     for(i=1;i<=n;i++)
  12.         for(j=1;j<=n;j++)
  13.             cin>>a[i][j];
  14.     for(i=1;i<=n;i++)
  15.         for(j=1;j<=n;j++)
  16.             if(a[i][j]!=0 && a[i][j]!=1)
  17.                 ok=0;
  18.     for(i=1;i<=n;i++)
  19.         for(j=1;j<=n;j++)
  20.             if(a[i][j]!=a[j][i])
  21.                 ok=0;
  22.     for(int i=1;i<=n;i++)
  23.         if(a[i][i]!=0)
  24.             ok=0;
  25.     if(ok==0)
  26.         cout<<0;
  27.     else
  28.         cout<<1;
  29.  
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top