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.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a[101][101], n, m, i, j, amax=0, gmax=0;
  6. void Citire();
  7.  
  8. int main()
  9. {
  10. Citire();
  11.  
  12. for (int j=1; j<=n; j++)
  13. {
  14. for(int i=1; i<=n; i++)
  15. a[0][j]+=a[i][j];
  16. }
  17.  
  18. for(int i=1; i<=n; i++)
  19. {
  20. if(a[0][i] > amax)
  21. {
  22. amax = a[0][i];
  23. gmax=i;
  24. }
  25. }
  26. cout<<gmax<<" ";
  27.  
  28. for(int i=1; i<=n; i++)
  29. {
  30. if(gmax!=i && amax==a[0][i])
  31. cout<<i<<" ";
  32. }
  33.  
  34. return 0;
  35. }
  36.  
  37. void Citire()
  38. {
  39. int x, y;
  40. cin>>n>>m;
  41. for(int i=1; i<=m; i++)
  42. {
  43. cin>>x>>y;
  44. a[x][y]=1;
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement