Guest User

Untitled

a guest
Nov 15th, 2019
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<fstream>
  2. using namespace std;
  3. int a[101][101], n, m, v[101]
  4. ifstream fin("grad.in");
  5. ofstream fout("grad.out");
  6. void citire()
  7. {
  8. int x,y,i;
  9. fin>>n>>m;
  10. for(i=1;i<=n;i++)
  11. {
  12. fin>>x>>y;
  13. a[x][y]=1;
  14. a[y][x]=1;
  15. }
  16. }
  17. int grade(int nod)
  18. {
  19. int d,i;
  20. for(i=1;i<=n;i++)
  21. d=d+a[nod][i];
  22. return d;
  23. }
  24. void retin_grade()
  25. {
  26. int i;
  27. for(i=1;i<=n;i++)
  28. v[i]=grade(i);
  29. }
  30. void grad_maxim()
  31. {
  32. int maxim=0,i;
  33. for(i=1;i<=n;i++)
  34. if(v[i]>maxim)
  35. maxim=v[i];
  36. for(i=1;i<=n;i++)
  37. if(v[i]==maxim)
  38. fout<<i<<" ";
  39. }
RAW Paste Data