Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include<vector>
  2. #include<iostream>
  3.  
  4. using std::vector;
  5. using std::cin;
  6. using std::cout;
  7. using std::clog;
  8. using std::endl;
  9.  
  10.  
  11.  
  12. int main(){
  13.     int n,m;
  14.     int u,v;
  15.     cin >> n >> m;
  16.     vector<int> degrees(n);
  17.     for(int x = 0; x < m; x++){
  18.         cin >> u >> v;
  19.         degrees[u]++;
  20.         degrees[v]++;
  21.     }
  22.     int total = 0;
  23.     for(int x =0; x < n; x++){
  24.         total += degrees[x]*degrees[x];
  25.     }
  26.     cout << total << endl;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement