Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <stdio.h>
- #include <math.h>
- #include <vector>
- struct Circle {
- int xc, yc, r;
- Circle(int xc = 0, int yc = 0, int r = 0) : xc(xc), yc(yc), r(r) { }
- inline bool include (double x, double y) {
- return (x-xc)*(x-xc) + (y-yc)*(y-yc) <= r*r;
- }
- } A, B;
- int main() {
- freopen("input.txt", "rt", stdin);
- freopen("output.txt", "wt", stdout);
- int r, s;
- scanf("%d %d %d %d %d %d", &A.xc, &A.yc, &B.xc, &B.yc, &r, &s);
- A.r = B.r = r;
- int nsteps = 10000;
- double dx = 2*r, dy = 2*r;
- dx /= nsteps;
- dy /= nsteps;
- std::vector<double> x(nsteps), y(nsteps);
- x[0] = A.xc - r + dx / 2;
- y[0] = A.yc - r + dy / 2;
- for (int i = 1; i < nsteps; ++i) {
- x[i] = x[i-1] + dx;
- y[i] = y[i-1] + dy;
- }
- int count = 0;
- for (auto & it_x : x)
- for (auto & it_y : y)
- if (A.include(it_x, it_y) && B.include(it_x, it_y))
- ++count;
- double same_square = 4.0 * count / nsteps / nsteps * r * r;
- printf((2*M_PI*r*r-same_square > s) ? "YES" : "NO");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement