Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <algorithm>
  5. #include <set>
  6. #include <unordered_map>
  7. #include <map>
  8. #include <string>
  9. using namespace std;
  10. double n, l;
  11. const double pi = 3.1415926535;
  12. double len(double k1, double g1)
  13. {
  14. return sqrt(g1 * g1 - k1 * k1);
  15. }
  16. double sqrci(double r)
  17. {
  18. return pi * r * r;
  19. }
  20.  
  21. int main()
  22. {
  23. cin >> n >> l;
  24. if(l <= (n / 2))
  25. {
  26. cout << sqrci(l);
  27. }
  28. double x = len(n / 2, l);
  29. double ang = asin(x / l);
  30. ang *= 2;
  31. double sqrsec = (ang / (2 * pi)) * sqrci(l);
  32. double sqrtry = x * (n / 2);
  33. cout << sqrci(l) - 4 * (sqrsec - sqrtry);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement