int main() {
    int R;
    double r;
    while (scanf("%d%lf", &R, &r) != EOF) {
        double low = 0.0;
        double high = 2 * R;
        double mid = 0;
        while ((high - low) >= 0.0001) {
            mid = (low + high) / 2;
            if (countArea(R, mid) > r) {
                high = mid;
            } else {
                low = mid;
            }
        }
        printf("%.2lf\n", mid);
    }
    return 0;
}
Example #2
0
void Touch::setContours(const vector<Point>& contours)
{
    contourPoints = vector<Point>(contours);
    middle = findMiddle();
    area = countArea();
}