fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n,m;
  5. cin >> n >> m;
  6. int b[10000][10000];
  7. for(int i = 0;i<m;i++) {
  8. int x,y;
  9. cin >> x >> y;
  10. // n is the number of nodes and m is the number of edges
  11. b[x][y] = 1;
  12. b[y][x] = 1;
  13. }
  14.  
  15. int cnt = 0; //Tells us how many nodes are exactly connected to node i
  16. for(int i = 0;i<n;i++) {
  17. int cnt = 0;
  18. for(int j = 0;j<n;j++) {
  19. if(b[i][j] == 1) cnt++;
  20. }
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty