๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.55K subscribers
5.58K photos
3 videos
95 files
9.89K 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
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

long double pi = 3.14159265358979323846;

long double volume(long double h, long double r) {
    return pi * h * h * (r - h/3);
}

long double find_height(long double r, long double v) {
    long double low = 0, high = r;
    long double eps = 1e-18;

    while (high - low > eps) {
        long double mid = (low + high) / 2;
        if (volume(mid, r) < v) {
            low = mid;
        } else {
            high = mid;
        }
    }
    return low;
}

int main() {
    long double r, v;
    cin >> r >> v;

    long double h = find_height(r, v);
    cout << fixed << setprecision(7) << h << endl;

    return 0;
}
Astrome || Binary Searchโœ…
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

string sortWord(string word) {
    transform(word.begin(), word.end(), word.begin(), ::tolower);
    vector<char> charArr(word.begin(), word.end());
    int sum = 0;
    for (char ch : charArr) {
        sum += ch - 'a' + 1;
    }
    sort(charArr.begin(), charArr.end());
    if (sum % 2 == 0) {
        return string(charArr.begin(), charArr.end());
    }
    reverse(charArr.begin(), charArr.end());
    return string(charArr.begin(), charArr.end());
}

int main() {
    string s;
    getline(cin, s);
    vector<string> strArr;
    size_t pos = 0;
    string delimiter = "-";
    while ((pos = s.find(delimiter)) != string::npos) {
        strArr.push_back(s.substr(0, pos));
        s.erase(0, pos + delimiter.length());
    }
    strArr.push_back(s);
   
    sort(strArr.begin(), strArr.end(), [](string a, string b) {
        transform(a.begin(), a.end(), a.begin(), ::tolower);
        transform(b.begin(), b.end(), b.begin(), ::tolower);
        return a < b;
    });
   
    transform(strArr.begin(), strArr.end(), strArr.begin(), sortWord);
   
    string result = strArr[0];
    for (int i = 1; i < strArr.size(); i++) {
        result += "-" + strArr[i];
    }
    cout << result << endl;

    return 0;
}
Astrome||Sort Wordโœ