๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.56K photos
3 videos
95 files
9.7K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
Company Name: Salesforce

Salesforce TDX is happening and you can participate with a prize money of 50 Lakhs.

Hackathon + 2 Days event in Bengaluru with more than 250+ sessions and prizes.

Eligibility: Students + Working Professionals.

All participants get a $200 voucher from Salesforce.

Link : https://sforce.co/li-tdxarsh

Registrations ending soon! Virtual Conference is FREE to attend.
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>


using namespace std;

int solve(int x1, int y1, int x2, int y2, int xc, int yc, int R) {
    int R_squared = R * R;
    int x_min = max(x1, xc - R);
    int x_max = min(x2, xc + R);
   
    if (x_min > x_max) {
        return 0;
    }
   
    int count = 0;
    for (int x = x_min; x <= x_max; ++x) {
        int dx = x - xc;
        int dx_squared = dx * dx;
        int remaining = R_squared - dx_squared;
       
        if (remaining < 0) {
            continue;
        }
       
        int ry = static_cast<int>(sqrt(remaining));
        int y_min_circle = yc - ry;
        int y_max_circle = yc + ry;
       
        int y_min = max(y1, y_min_circle);
        int y_max = min(y2, y_max_circle);
       
        if (y_min > y_max) {
            continue;
        }
       
        count += (y_max - y_min + 1);
    }
   
    return count;
}

int main() {
    int x1, y1, x2, y2, xc, yc, R;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> xc >> yc >> R;
    cout << solve(x1, y1, x2, y2, xc, yc, R) << endl;
    return 0;
}
conditional coordinates โœ