Advertisement
velimir

Triagolnici

Mar 30th, 2013
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. struct pole{
  7.     int x, y;
  8. };
  9. int main()
  10. {
  11.     int n, i, j, l, count=0, a, b, c;
  12.     cin >> n;
  13.     pole niza[n];
  14.     for(i = 0; i<n; i++)cin >> niza[i].x >> niza[i].y;
  15.     for(i = 0; i<n; i++)
  16.         for(j = i+1; j<n; j++)
  17.             for(l = j+1; l<n; l++)
  18.             {
  19.                 a = (pow(niza[j].x-niza[l].x, 2) + pow(niza[j].y-niza[l].y, 2))+0.00001;
  20.                 b = (pow(niza[i].x-niza[l].x, 2) + pow(niza[i].y-niza[l].y, 2))+0.00001;
  21.                 c = (pow(niza[i].x-niza[j].x, 2) + pow(niza[i].y-niza[j].y, 2))+0.00001;
  22.                 if(c == a+b)count++;
  23.                 else if(a == c+b)count++;
  24.                 else if(b == a+c)count++;
  25.             }
  26.     cout << count;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement