Advertisement
Guest User

Untitled

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