結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,616 KB
testcase_01 AC 124 ms
55,712 KB
testcase_02 AC 125 ms
55,652 KB
testcase_03 AC 124 ms
55,960 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 126 ms
55,460 KB
testcase_07 AC 127 ms
55,660 KB
testcase_08 AC 126 ms
55,860 KB
testcase_09 AC 126 ms
55,964 KB
testcase_10 AC 126 ms
55,896 KB
testcase_11 AC 125 ms
55,504 KB
testcase_12 AC 123 ms
55,464 KB
testcase_13 AC 122 ms
55,960 KB
testcase_14 AC 122 ms
55,784 KB
testcase_15 AC 121 ms
55,980 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 123 ms
55,784 KB
testcase_23 AC 128 ms
55,708 KB
testcase_24 AC 124 ms
55,464 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 = 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(left - right) <= Math.pow(10, -5) ) break;
        if(res1 < res2)
          left = mid;
        else
          right = mid;
      }
      System.out.println(right);
  }
}
0