Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int a[101][101],n,m,i,j,C;
  7.  
  8. void citire();
  9.  
  10. int main()
  11. {
  12. citire();
  13. for(i=1;i<=n;i++)
  14. {
  15. for(j=1;j<=n;j++)
  16. a[i][0]+=a[i][j];
  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.  
  25. for(i=1;i<=n;i++)
  26. {
  27. if(a[i][0]==a[0][i])
  28. C++;
  29.  
  30. }
  31. cout<<C<<endl;
  32. for(i=1;i<=n;i++)
  33. {
  34. if(a[0][i]==a[i][0])
  35. cout<<i<<" ";
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. return 0;
  43. }
  44.  
  45. void citire()
  46. {
  47. int x,y;
  48. cin>>n>>m;
  49. for(i=1;i<=m;i++)
  50. {
  51. cin>>x>>y;
  52. a[x][y]=1;
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement