結果

問題 No.1042 愚直大学
ユーザー hiro71687k
提出日時 2023-04-12 10:52:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 3,390 ms
コンパイル使用メモリ 250,744 KB
最終ジャッジ日時 2025-02-12 05:14:40
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=1444999999999999;
ll mod=998244353;
int main(){
    ld p,q;
    cin >> p >> q;
    ld left=1.0,right=inf;
    for (ll i = 0; i < 1000; i++)
    {
        ld mid=(right+left)/2.0;
        ld x=log(2.0);
        ld y=log(mid);
        y/=x;
        if (mid*mid<q*mid*y+p)
        {
            left=mid;
        }else{
            right=mid;
        }
    }
    cout << setprecision(100) << left << endl;
}
0