Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const double PI = acos(-1.0);
- const int maxn = 100000 + 100;
- struct Node {
- double l, r;
- Node() {}
- Node(double l, double r): l(l), r(r) {}
- };
- bool operator<(const Node &a, const Node &b) {
- return a.l < b.l;
- }
- int n;
- LL x, y, r;
- double k, sum, ll, rr, theta1, theta2;
- Node node[maxn];
- int main() {
- #ifdef ExRoc
- freopen("test.txt", "r", stdin);
- #endif // ExRoc
- ios::sync_with_stdio(false);
- cin >> n;
- for (int i = 0; i < n; ++i) {
- cin >> x >> y >> r;
- double theta = asin(r / sqrt(x * x + y * y));
- double beta = atan(y * 1.0 / x);
- node[i] = Node(beta - theta, beta + theta);
- }
- sort(node, node + n);
- for (int i = 0; i < n; ++i) {
- if (rr < node[i].l) {
- sum += rr - ll;
- rr = node[i].r;
- ll = node[i].l;
- } else {
- rr = max(node[i].r, rr);
- }
- }
- sum += rr - ll;
- printf("%.3lf\n", 1 - sum / (PI / 2));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement