Saleh127

codeforces 157B.cpp

May 26th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define pi acos(-1)
  6. int main()
  7. {
  8. ll a[100000],c;
  9. double ans=0.0,x;
  10. ll i,j,k,l;
  11. cin>>k;
  12. for(i=0;i<k;i++)
  13. {
  14. cin>>a[i];
  15. }
  16. sort(a,a+k,greater<int>());
  17. for(i=0;i<k;i++)
  18. {
  19. if(i%2==0)
  20. {
  21. ans+=pi*a[i]*a[i];
  22. }
  23. else if(i%2==1)
  24. {
  25. ans-=pi*a[i]*a[i];
  26. }
  27. }
  28. printf("%.10lf\n",ans);
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment