Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <cmath>
- #define N int(1e5 + 5)
- using namespace std;
- typedef long long LL;
- int n, x[N], y[N], r[N];
- bool in[N];
- LL sqr(LL a) {
- return a * a;
- }
- int main() {
- freopen("circles.in", "r", stdin);
- freopen("circles.out", "w", stdout);
- scanf("%d ", &n);
- for (int i = 0; i < n; i++)
- scanf("%d %d %d ", x + i, y + i, r + i);
- if (n <= 5000) {
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++) {
- if (i == j) continue;
- if (sqr(r[i] - r[j]) >= sqr(x[i] - x[j]) + sqr(y[i] - y[j]) && r[i] <= r[j])
- in[i]++;
- }
- }
- long double res = 0;
- for (int i = 0; i < n; i++)
- if (!in[i])
- res += M_PI * sqr(r[i]);
- cout.precision(9);
- cout << fixed << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement