結果

問題 No.1042 愚直大学
ユーザー joybeeeejoybeeee
提出日時 2020-05-13 12:00:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 72,148 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-10-12 16:57:02
合計ジャッジ時間 6,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 119 ms
55,880 KB
testcase_02 AC 116 ms
55,912 KB
testcase_03 AC 116 ms
56,352 KB
testcase_04 AC 119 ms
55,780 KB
testcase_05 AC 119 ms
55,960 KB
testcase_06 AC 119 ms
55,980 KB
testcase_07 AC 119 ms
55,812 KB
testcase_08 AC 120 ms
55,684 KB
testcase_09 AC 120 ms
55,460 KB
testcase_10 AC 119 ms
55,788 KB
testcase_11 AC 120 ms
56,428 KB
testcase_12 AC 119 ms
55,704 KB
testcase_13 AC 119 ms
54,024 KB
testcase_14 AC 120 ms
55,644 KB
testcase_15 AC 119 ms
56,292 KB
testcase_16 AC 119 ms
56,488 KB
testcase_17 AC 117 ms
56,244 KB
testcase_18 AC 117 ms
55,928 KB
testcase_19 AC 118 ms
56,180 KB
testcase_20 AC 119 ms
56,112 KB
testcase_21 AC 121 ms
56,300 KB
testcase_22 AC 120 ms
55,900 KB
testcase_23 AC 120 ms
55,824 KB
testcase_24 AC 121 ms
55,748 KB
権限があれば一括ダウンロードができます

ソースコード

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 = Double.MAX_VALUE;
      while(right - left > 10e-5) {
        double mid = left + (right - left) / 2;
        double res1 = mid * mid;
        double res2 = p + q * mid * Math.log(mid) / Math.log(2);
        if(res1 < res2)
          left = mid;
        else
          right = mid;
      }
      System.out.println(right);
  }
}
0