crsandu

Adiacenta - 80p

Apr 1st, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("adiacenta.in");
  7. ofstream fout("adiacenta.out");
  8.  
  9. int ma[100][100] = {0}, x, y, n, m;
  10.  
  11. int main()
  12. {
  13. fin >> n >> m;
  14. for (int p=1; p<=m; p++)
  15. {
  16. fin >> x >> y;
  17. ma[x][y] = ma[y][x] = 1;
  18. }
  19. for (int i=1; i<=n; i++)
  20. {
  21. for (int j=1; j<=n; j++)
  22. {
  23. fout << ma[i][j] << " ";
  24. }
  25. fout << endl;
  26. }
  27. fin.close();
  28. fout.close();
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment