fork download
  1. #include <iostream>
  2.  
  3. const int N = 2005;
  4.  
  5. int x[N], y[N];
  6. int n;
  7.  
  8. int main() {
  9. std::ios_base::sync_with_stdio(0);
  10. std::cin.tie(0);
  11. std::cin >> n;
  12. for (int i = 1; i <= n; i++) {
  13. std::cin >> x[i] >> y[i];
  14. }
  15. int ans = 0;
  16. for (int i = 3; i <= n; i++) {
  17. double a[N];
  18. for (int j = 1; j < i; j++) {
  19. if (x[i] == x[j]) {
  20. a[j] = -1e9;
  21. } else {
  22. a[j] = 1. * (y[i] - y[j]) / (x[i] - x[j]);
  23. }
  24. }
  25. for (int j = 1; j < i; j++) {
  26. for (int k = j + 1; k < i; k++) {
  27. ans += a[j] == a[k];
  28. }
  29. }
  30. }
  31. std::cout << ans;
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty