Advertisement
Guest User

URI 1076 - Thales

a guest
Jul 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. #define h 100
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. int mat[h][h], t, n, v, a, x, y, tot;
  9.  
  10. scanf("%d", &t);
  11.  
  12. while(t--){
  13. scanf("%d %d %d", &n, &v, &a);
  14.  
  15. for(int i = 0; i < v; i++){
  16. for(int j = 0; j < v; j++){
  17. mat[i][j] = 0;
  18. }
  19. }
  20.  
  21. for(int i = 0; i < a; i++){
  22. scanf("%d %d", &x, &y);
  23.  
  24. mat[x][y] = 1;
  25. mat[y][x] = 1;
  26. }
  27.  
  28. tot = 0;
  29. for(int i = 0; i < v; i++){
  30. for(int j = i; j < v; j++){
  31. tot += mat[i][j];
  32. }
  33. }
  34.  
  35. printf("%d\n", tot * 2);
  36. }
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement