Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include<fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream f("adiacenta.in");
  7. ofstream g("adiacenta.out");
  8.  
  9. int a[101][101];
  10. int main()
  11. {
  12. int n,m,i,j,x,y;
  13. f>>n>>m;
  14. for(i=1;i<=m;i++)
  15. {
  16. f>>x>>y;
  17. a[x][y]=a[y][x]=1;
  18. }
  19. for(i=1;i<=n;i++)
  20. {
  21. for(j=1;j<=n;j++)
  22. g<<a[i][j]<<" ";
  23. g<<endl;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement