結果

問題 No.1042 愚直大学
ユーザー butsurizuki
提出日時 2020-05-27 02:30:57
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 03:10:15
合計ジャッジ時間 954 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<math.h>

double tak(double n){
  return n*n;
}

double p,q;
double hik(double n){
  return p+q*n*log2(n);
}

double solve(){
  double st,fi,te;
  st=1.0e-20;fi=1.0e20;
  int i;
  for(i=0;i<200;i++){
    te=sqrt(st*fi);
    //te=(st+fi)/2.0;
    if(tak(te)<hik(te)){st=te;}
    else{fi=te;}
  }
  return sqrt(st*fi);//(st+fi)/2.0;
}

int main(){
  scanf("%lf%lf",&p,&q);
  printf("%.12lf\n",solve());
  return 0;
}
0