牛客练习赛63 B.牛牛的鱼缸

牛牛的鱼缸

http://www.nowcoder.com/questionTerminal/effcbbd92a5b43f987d555b47560e9f4

简单的几何题,分两种情况判断

![图片说明](https://uploadfiles.nowcoder.com/compress/mw1000/images/20200509/807126818_1588982694882_E9B5B47FD1F6E466EE28E9CA7CE6572E "图片标题")
附代码

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lowbit(x) x&(-x)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

const int N = 1e5+5;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double eps =1e-9;
const double PI=acos(-1.0);
const int dir[8][2]={-1,0,1,0,0,-1,0,1,1,1,1,-1,-1,1,-1,-1};

ll qpow(ll x,ll y){
    ll ans=1,t=x;
    while(y>0){
        if(y&1)ans*=t,ans%=mod;
        t*=t,t%=mod;
        y>>=1;
    }
    return ans%mod;
}

void solve(){
    int h,l,H,L;
    cin>>h>>l>>H>>L;
    if(h*L<=H*l)printf("%f",h*h*L/(2.0*H));
    else printf("%f",(h-l*H/(2.0*L))*l);
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //int t;cin>>t;
    //while(t--)solve(),cout<<'\n';
    solve();
    return 0;
}

全部评论

相关推荐

评论
10
收藏
分享
牛客网
牛客企业服务