Saleh127

UVA 12816 / Geo

Oct 8th, 2021 (edited)
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int tt; cin>>tt; for(int cs=1;cs<=tt;cs++)
  5.  
  6. double distan(double x,double y,double x1,double y1)
  7. {
  8.      return sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1));
  9. }
  10.  
  11. int main()
  12. {
  13.    ios_base::sync_with_stdio(0);
  14.    cin.tie(0);cout.tie(0);
  15.  
  16.    ll i,j,k,n;
  17.  
  18.  
  19.    while(cin>>n)
  20.    {
  21.         double x[n+1],y[n+1];
  22.  
  23.         for(i=0;i<n;i++)
  24.         {
  25.              cin>>x[i]>>y[i];
  26.         }
  27.  
  28.  
  29.         double a,b,c,d,e;
  30.  
  31.         ll ans=0;
  32.  
  33.         for(i=0;i<n-2;i++)
  34.         {
  35.              for(j=i+1;j<n-1;j++)
  36.              {
  37.                   for(k=j+1;k<n;k++)
  38.                   {
  39.                        a=distan(x[i],y[i],x[j],y[j]);
  40.                        b=distan(x[i],y[i],x[k],y[k]);
  41.                        c=distan(x[j],y[j],x[k],y[k]);
  42.  
  43.                        double ck[3];
  44.                        ck[0]=a;
  45.                        ck[1]=b;
  46.                        ck[2]=c;
  47.  
  48.                        sort(ck,ck+3);
  49.  
  50.                        if(ck[0]+ck[1]>ck[2])
  51.                        {
  52.                             if(ck[0]==ck[1] && ck[0]!=ck[2]) ans++;
  53.                             else if(ck[2]==ck[1] && ck[0]!=ck[2]) ans++;
  54.                        }
  55.                   }
  56.              }
  57.         }
  58.  
  59.         cout<<ans<<endl;
  60.    }
  61.  
  62.  
  63.    return 0;
  64. }
  65.  
  66.  
Add Comment
Please, Sign In to add comment