QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#616939#5151. Bottle FlipRafat_KabirAC ✓0ms3924kbC++203.0kb2024-10-06 13:08:202024-10-06 13:08:20

Judging History

你现在查看的是最新测评结果

  • [2024-10-06 13:08:20]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3924kb
  • [2024-10-06 13:08:20]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>

using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>

using namespace __gnu_pbds;
using namespace std;
template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// to erase in multiset-> less_equal<T> and 
// s.erase(s.find_by_order(s.order_of_key(x)))
// lower_bound(x)=>(cannot use the stl lower_bound function)
// ll idx = s.order_of_key(x)
// if(idx == s.size()) -> no lower_bound
// else lb = *s.find_by_order(idx) // as 0-indexing
// idx-1 will give highest value which is strictly less than x
// for upper_bound->do the same with (x+1)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef tuple<ll, ll, ll> t64;
typedef vector<t64> vt64;
typedef vector<vt64> vvt64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef vector<vector<p32> > vvp32;
typedef vector<bool> vb;
ll mod =  1e9+7, MOD = 998244353;
double eps = 1e-12;
// #define forn(i,e) for(ll i = 0; i < e; i++)
#define FOR(s, e, i) for(int i = s; i <= e; i++)
// #define rforn(i,s) for(ll i = s; i >= 0; i--)
#define ROF(s ,e, i) for(int i = s; i >= e; i--)
#define coutAll(A) for(auto asdafas : A) cout <<  asdafas << " "; cout << "\n";
#define foutAll(A) for(auto asdafas : A) fout <<  asdafas << " "; cout << "\n";
#define cinAll(A) for(auto &asdafas : A) cin >>  asdafas;
#define finAll(A) for(auto &asdafas : A) fin >>  asdafas;
#define minpq priority_queue<ll, v64, greater<ll>>
#define maxpq priority_queue<ll> 
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
ll inf = LLONG_MAX;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pii;
//#define MAXN 1000000

void solve(int it)
{
    double h, r, da, dw;
    cin >> h >> r >> da >> dw;
    double a = dw-da;
    double ans = -2*h*da+sqrt(4*h*h*da*da+4*a*h*h*da);
    ans /= 2*a;
    cout << fixed << setprecision(20)<< ans;
}


int main()
{
    fast_cin();    
    ll t = 1;
    // cin >> t;
    for(int it=1; it<=t; it++)
    {
        //cout << "Case " << it << ": ";
        solve(it);
    }
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3816kb

input:

22 4 1 4

output:

7.33333333333333303727

result:

ok found '7.3333333', expected '7.3333333', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

7 2 655 988

output:

3.14159417202004220826

result:

ok found '3.1415942', expected '3.1415942', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

1 1 1 2

output:

0.41421356237309514547

result:

ok found '0.4142136', expected '0.4142136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

1000 1000 999 1000

output:

499.87493746087420731783

result:

ok found '499.8749375', expected '499.8749375', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

1000 1000 1 1000

output:

30.65343003171550861907

result:

ok found '30.6534300', expected '30.6534300', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

1 1000 1 1000

output:

0.03065343003171550756

result:

ok found '0.0306534', expected '0.0306534', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

1000 1000 482 483

output:

499.74093257292406633496

result:

ok found '499.7409326', expected '499.7409326', error '0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

1 1000 482 483

output:

0.49974093257293361603

result:

ok found '0.4997409', expected '0.4997409', error '0.0000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

1 1000 1 2

output:

0.41421356237309514547

result:

ok found '0.4142136', expected '0.4142136', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

1000 1000 1 2

output:

414.21356237309510106570

result:

ok found '414.2135624', expected '414.2135624', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

961 1000 979 983

output:

480.01019317095051519573

result:

ok found '480.0101932', expected '480.0101932', error '0.0000000'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

997 1000 977 983

output:

497.73698800835217070926

result:

ok found '497.7369880', expected '497.7369880', error '0.0000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1 928 1 66

output:

0.10960059084055324974

result:

ok found '0.1096006', expected '0.1096006', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

1 928 2 88

output:

0.13100580420257673664

result:

ok found '0.1310058', expected '0.1310058', error '0.0000000'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

1 928 3 74

output:

0.16760090740494845707

result:

ok found '0.1676009', expected '0.1676009', error '0.0000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1 928 3 41

output:

0.21290885543182677675

result:

ok found '0.2129089', expected '0.2129089', error '0.0000000'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1 928 1 12

output:

0.22400923773979586340

result:

ok found '0.2240092', expected '0.2240092', error '0.0000000'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

2 928 89 93

output:

0.98900966167542492258

result:

ok found '0.9890097', expected '0.9890097', error '0.0000000'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

7 928 51 72

output:

3.19900987672415704210

result:

ok found '3.1990099', expected '3.1990099', error '0.0000000'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

722 547 709 752

output:

355.68639181927659365101

result:

ok found '355.6863918', expected '355.6863918', error '0.0000000'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

242 742 518 920

output:

103.74290346112387339872

result:

ok found '103.7429035', expected '103.7429035', error '0.0000000'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

873 701 43 201

output:

276.08755584783057202003

result:

ok found '276.0875558', expected '276.0875558', error '0.0000000'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

268 228 527 562

output:

131.84609193632994106338

result:

ok found '131.8460919', expected '131.8460919', error '0.0000000'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

312 558 341 839

output:

121.46838507794339534485

result:

ok found '121.4683851', expected '121.4683851', error '0.0000000'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

274 85 178 364

output:

112.75649069206443186886

result:

ok found '112.7564907', expected '112.7564907', error '0.0000000'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

641 539 341 977

output:

238.05443874042825314064

result:

ok found '238.0544387', expected '238.0544387', error '0.0000000'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

245 861 438 872

output:

101.61838392187294743962

result:

ok found '101.6183839', expected '101.6183839', error '0.0000000'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

640 181 156 606

output:

215.41983489088707415249

result:

ok found '215.4198349', expected '215.4198349', error '0.0000000'