SHARE
TWEET

922

dumitreskw Jan 17th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include<iomanip>
  4. using namespace std;
  5.  
  6. struct punct
  7. {
  8.     int x,y,d;
  9. };
  10. punct v[101];
  11. int n;
  12.  
  13. int distanta(int x,int y)
  14. {
  15.     return x*x+y*y;
  16. }
  17.  
  18. void citire ()
  19. {
  20.     int i,dmax=0,k=0;
  21.     cin>>n;
  22.     for(i=1;i<=n;i++)
  23.     {
  24.         cin>>v[i].x>>v[i].y;
  25.         v[i].d=distanta(v[i].x,v[i].y);
  26.         if(v[i].d>dmax)
  27.             dmax=v[i].d;
  28.     }
  29.     for(i=1;i<=n;i++)
  30.         if(v[i].d==dmax)
  31.         k++;
  32.     double dreal=sqrt((double)dmax);
  33.     dreal=dreal*1000;
  34.     dmax=(int)dreal;
  35.     dreal=(double)dmax/1000;
  36.     cout<<fixed<<setprecision(3)<<dreal<<" "<<k;
  37. }
  38.  
  39. int main()
  40. {
  41.    citire();
  42.     return 0;
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top