Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <algorithm>
- #include <set>
- #include <unordered_map>
- #include <map>
- #include <string>
- using namespace std;
- double n, l;
- const double pi = 3.1415926535;
- double len(double k1, double g1)
- {
- return sqrt(g1 * g1 - k1 * k1);
- }
- double sqrci(double r)
- {
- return pi * r * r;
- }
- int main()
- {
- cin >> n >> l;
- if(l <= (n / 2))
- {
- cout << sqrci(l);
- }
- double x = len(n / 2, l);
- double ang = asin(x / l);
- ang *= 2;
- double sqrsec = (ang / (2 * pi)) * sqrci(l);
- double sqrtry = x * (n / 2);
- cout << sqrci(l) - 4 * (sqrsec - sqrtry);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement