Advertisement
xSpydy

dabns

Feb 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. ifstream fin("graf_complet.in");
  6. ofstream fout("graf_complet.out");
  7.  
  8. int a[101][101], gr[101];
  9. int main()
  10. {
  11. int n, x, g;
  12. bool ok=true;
  13.  
  14. fin>>g;
  15.  
  16. while(g)
  17. {
  18. fin>>n;
  19. for(int i=1; i<n+1; i++)
  20. for(int j=1; j<n+1; j++)
  21. {
  22. fin>>x;
  23. a[i][j] = x;
  24. }
  25.  
  26. for(int i=1; i<n+1; i++)
  27. for(int j=1; j<n+1; j++)
  28. if(a[i][j] == 0 && i!=j)
  29. ok=false;
  30.  
  31. if(ok)fout<<"DA"<<endl;
  32. else fout<<"NU"<<endl;
  33.  
  34. for(int i=1; i<n+1; i++)
  35. for(int j=1; j<n+1; j++)
  36. a[i][j]=0;
  37. g--;
  38. ok = true;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement