๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.61K photos
3 videos
95 files
10.6K 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<bits/stdc++.h>
using namespace std;

int main(){
    int n,u,l; cin>>n>>u>>l;
    vector<int>a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    vector<vector<int>>v(2, vector<int>(n,0));
    for(int i=0; i<n; i++){
        if(a[i]==2){
            v[0][i]=1;
            v[1][i]=1;
            u--,l--;
        }
    }
    for(int i=0; i<n; i++){
        if(a[i]==1){
            if(u>0){
                u--;
                v[0][i]=1;
            }
            else{
                v[1][i]=1;
                l--;
            }
        }
    }
    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++)
        cout<<v[i][j]<<" \n"[j==n-1];
    }
}

American express 2nd(by John)
๐Ÿ‘1
#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โœ