結果

問題 No.1042 愚直大学
ユーザー motmot
提出日時 2020-05-01 21:51:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 75,848 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 09:18:26
合計ジャッジ時間 3,223 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
4,376 KB
testcase_01 AC 53 ms
4,376 KB
testcase_02 AC 20 ms
4,376 KB
testcase_03 AC 53 ms
4,380 KB
testcase_04 AC 54 ms
4,380 KB
testcase_05 AC 53 ms
4,376 KB
testcase_06 AC 53 ms
4,380 KB
testcase_07 AC 53 ms
4,376 KB
testcase_08 AC 53 ms
4,376 KB
testcase_09 AC 53 ms
4,380 KB
testcase_10 AC 53 ms
4,376 KB
testcase_11 AC 53 ms
4,380 KB
testcase_12 AC 53 ms
4,380 KB
testcase_13 AC 53 ms
4,380 KB
testcase_14 AC 53 ms
4,376 KB
testcase_15 AC 53 ms
4,376 KB
testcase_16 AC 53 ms
4,380 KB
testcase_17 AC 54 ms
4,376 KB
testcase_18 AC 53 ms
4,376 KB
testcase_19 AC 53 ms
4,376 KB
testcase_20 AC 53 ms
4,380 KB
testcase_21 AC 53 ms
4,376 KB
testcase_22 AC 53 ms
4,380 KB
testcase_23 AC 53 ms
4,376 KB
testcase_24 AC 53 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;

int main() {
    ll P, Q;
    cin>>P>>Q;
    double l, m, r;
    l = 0;
    r = 1e20;
    for(int i=0;i<1000000;++i){
        m = (l+r)/2;
        if(P+Q*m*log2(m)-m*m>0){
            l = m;
        }
        else{
            r = m;
        }
    }
    cout<<setprecision(20)<<l<<endl;
}

0