結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,652 KB
testcase_01 AC 123 ms
55,712 KB
testcase_02 AC 121 ms
56,048 KB
testcase_03 AC 120 ms
56,076 KB
testcase_04 AC 123 ms
56,068 KB
testcase_05 AC 121 ms
56,244 KB
testcase_06 AC 122 ms
55,984 KB
testcase_07 AC 123 ms
55,932 KB
testcase_08 AC 122 ms
56,396 KB
testcase_09 AC 120 ms
55,952 KB
testcase_10 AC 121 ms
56,140 KB
testcase_11 AC 123 ms
56,108 KB
testcase_12 AC 121 ms
55,808 KB
testcase_13 AC 122 ms
56,012 KB
testcase_14 AC 123 ms
55,964 KB
testcase_15 AC 123 ms
55,616 KB
testcase_16 AC 122 ms
56,244 KB
testcase_17 AC 122 ms
55,912 KB
testcase_18 AC 121 ms
56,052 KB
testcase_19 AC 123 ms
55,640 KB
testcase_20 AC 122 ms
55,672 KB
testcase_21 AC 125 ms
55,704 KB
testcase_22 AC 122 ms
55,912 KB
testcase_23 AC 123 ms
56,376 KB
testcase_24 AC 123 ms
56,164 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-6) {
        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