結果

問題 No.1042 愚直大学
ユーザー umezo
提出日時 2022-02-06 18:58:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 2,258 ms
コンパイル使用メモリ 193,364 KB
最終ジャッジ日時 2025-01-27 20:38:13
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const double EPS=1e-9;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  double p,q;
  cin>>p>>q;
  double ok=1,ng=1e18;
  
  auto f=[&](double x){
    if(x*x<p+q*x*log2(x)+EPS) return true;
    return false;
  };
  
  rep(i,100){
    double mid=(ok+ng)/2;
    if(f(mid)) ok=mid;
    else ng=mid;
  }
  printf("%.10f",ok);

  return 0;
}
0