Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<vector>
- #include<iostream>
- using std::vector;
- using std::cin;
- using std::cout;
- using std::clog;
- using std::endl;
- int main(){
- int n,m;
- int u,v;
- cin >> n >> m;
- vector<int> degrees(n);
- for(int x = 0; x < m; x++){
- cin >> u >> v;
- degrees[u]++;
- degrees[v]++;
- }
- int total = 0;
- for(int x =0; x < n; x++){
- total += degrees[x]*degrees[x];
- }
- cout << total << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement