Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a[101][101],n,m,i,j,ok=0;
  6.  
  7. void Citgr();
  8.  
  9. int main()
  10. {
  11. Citgr();
  12. for(i=1;i<=n;i++)
  13. {
  14. for(j=1;j<=n;j++)
  15. a[i][0]+=a[i][j];
  16. }
  17.  
  18. for(j=1;j<=n;j++)
  19. {
  20. for(i=1;i<=n;i++)
  21. a[0][j]+=a[i][j];
  22. }
  23.  
  24. for(i=1;i<=n;i++)
  25. {
  26. if(a[0][i] == 0)
  27. {
  28. cout<<i<<" ";
  29. ok=1;
  30. }
  31. }
  32. if(ok==0)
  33. cout<<"NU EXISTA";
  34.  
  35. return 0;
  36. }
  37.  
  38. void Citgr()
  39. {
  40. int x,y;
  41. cin>>n>>m;
  42. for(i=1;i<=m;i++)
  43. {
  44. cin>>x>>y;
  45. a[x][y]=1;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement