Advertisement
jeff69

Untitled

Apr 8th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. // ConsoleApplication211.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iomanip>
  6. #include <iostream>
  7. #include <functional>
  8. #include <algorithm>
  9. #include <math.h>
  10. #include <cmath>
  11. #include <string>
  12. #include <cstring>
  13. #include <vector>
  14. #include<set>
  15. #include<map>
  16. #include <time.h>
  17. #include <fstream>
  18. typedef long long ll;
  19. using namespace std;
  20.  
  21. /*
  22. 4
  23. 13 7 5
  24. 7 13 6
  25. 14 3 12
  26. 15 6 16
  27. 0
  28. */
  29. int main(){
  30.  
  31. map<pair<int, int>,int >mp;
  32. int n;
  33. cin >> n;
  34. int ans = 0;
  35. int x[2001], y[2001];
  36. for (int i = 0; i < n; i++){
  37.  
  38. cin >>x[i]>> y[i];
  39.  
  40. }
  41. map<pair<int, int>, int >mp2;
  42. for (int i = 0; i < n; i++){
  43. for (int k = i+1; k < n; k++){
  44.  
  45. pair<int, int> d,d2,d3,d4;
  46. d.first = -(x[k] - x[i]);
  47. d.second = (y[i] - y[k]);
  48. d2.first = -d.first;
  49. d2.second = -d.second;
  50.  
  51. ans += mp[d];
  52. ans += mp2[d2];
  53. //ans += mp[d2];
  54. /*if (d.first==-1&&d.second==0){
  55. cout << d.first << d.second << '\n';
  56. cout << mp[d]<<'\t'<<ans << "\n";
  57. }*/
  58.  
  59. ++mp2[d2];
  60. ++mp[d];
  61.  
  62.  
  63. }
  64. }
  65. cout << ans;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement