fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,m;
  6. cin>>n>>m;
  7. int a[n][n]={0};
  8. for(int i=0;i<m;i++)
  9. {
  10. int x,y;
  11. cin>>x>>y;
  12. a[x][y]=1;
  13. a[y][x]=1;
  14. }
  15. for(int i=0;i<n;i++)
  16. {
  17. int c=0;
  18. for(int j=0;j<n;j++)
  19. {
  20. if(a[i][j]==1)
  21. {
  22. c++;
  23. }
  24. }
  25. cout<<c<<endl;
  26. }
  27.  
  28. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
0
0