Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cassert>
  4. using namespace std;
  5.  
  6. ifstream fin("adiacenta1.in");
  7. ofstream fout("adiacenta1.out");
  8.  
  9. int n,a[105][105];
  10.  
  11. int main()
  12. {
  13. int i , j;
  14. while(fin >> i >> j){
  15. a[i][j] = a[j][i] = 1;
  16. if(i > n)
  17. n = i;
  18. if(j > n)
  19. n = j;
  20. }
  21.  
  22. for(int i = 1 ; i <= n ; i++){
  23. for(int j = 1; j <= n ; ++j)
  24. fout << a[i][j] << " ";
  25. fout << "\n";
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement