Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define mp make_pair
  4. #define e1 first
  5. #define e2 second
  6. #define pb push_back
  7. typedef pair <int, int> PII;
  8. typedef unsigned int ui;
  9. typedef unsigned long long int ull;
  10. typedef long long int ll;
  11. typedef long double ld;
  12. typedef pair <int, ll> PIL;
  13. typedef pair <ll, int> PLI;
  14. typedef pair <ll, ll> PLL;
  15. const int mod = 1e9+7;
  16. const int inf = 1e9+9;
  17. const ll MOD = 1e9+696969;
  18. const ll INF = ll(1e18) + 3;
  19. const ld PI = 3.1415926535897932;
  20.  
  21.  
  22. ld a, r;
  23. ld WYNALL;
  24. ld todegree(ld a)
  25. {
  26.     return a * (180.0 / PI);
  27. }
  28. void F(ld a, ld r)
  29. {
  30.     ld apol = a * 0.5;
  31.     ld pole = PI * r * r;
  32.     ld katrad = asin(a / (2 * r) );
  33.     ld katdeg = todegree(katrad) * 2;
  34.     ld wyn = (katdeg / 360) * pole;
  35.     ld H = sqrt(r*r - apol * apol);
  36.     wyn -= (apol * H);
  37.     WYNALL += wyn;
  38. }
  39. int main()
  40. {
  41.     ld r1, r2;
  42.     cin >> a >> r1 >> r2;
  43.     F(a, r1); F(a, r2);
  44.     cout << fixed;
  45.     cout << setprecision(15);
  46.     cout << WYNALL;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement