fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8.  
  9. int X[2000], Y[2000];
  10. int x_Count = 0, y_Count = 0;
  11.  
  12. for (int i = 0; i < n; i++) {
  13. int x, y;
  14. cin >> x >> y;
  15. if (y == 0) {
  16. X[x_Count++] = abs(x);
  17. } else {
  18. Y[y_Count++] = abs(y);
  19. }
  20. }
  21.  
  22. int count = 0;
  23.  
  24. for (int i = 0; i < x_Count; i++) {
  25. for (int j = i + 1; j < x_Count; j++) {
  26. int prod_x = X[i] * X[j];
  27.  
  28. for (int k = 0; k < y_Count; k++) {
  29. for (int l = k + 1; l < y_Count; l++) {
  30. int prod_y = Y[k] * Y[l];
  31. if (prod_x == prod_y) {
  32. count++;
  33. }
  34. }
  35. }
  36. }
  37. }
  38.  
  39. cout << count << "\n";
  40.  
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0.01s 5288KB
stdin
10
1 0
3 0
5 0
0 7
0 2
0 4
0 5
2 0
9 0
0 6
stdout
1