結果

問題 No.1042 愚直大学
ユーザー joybeeee
提出日時 2020-05-13 11:56:12
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 2,245 ms
コンパイル使用メモリ 74,648 KB
実行使用メモリ 61,364 KB
最終ジャッジ日時 2024-09-14 15:32:05
合計ジャッジ時間 7,732 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 2 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int p = sc.nextInt();
      int q = sc.nextInt();

      double left = 1.0, right = Math.pow(10, 9);
      while(left < right) {
        double mid = left + (right - left) / 2;
        double res1 = mid * mid;
        double res2 = p + q * mid * Math.log(mid) / Math.log(2);
        if(Math.abs(res2 - res1) <= Math.pow(10, -5) ) break;
        if(res1 < res2)
          left = mid;
        else
          right = mid;
      }
      System.out.println(right);
  }
}
0