結果

問題 No.1042 愚直大学
ユーザー joybeeeejoybeeee
提出日時 2020-05-13 11:56:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 71,788 KB
実行使用メモリ 60,060 KB
最終ジャッジ日時 2023-10-12 16:56:35
合計ジャッジ時間 7,521 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
60,060 KB
testcase_01 AC 124 ms
55,784 KB
testcase_02 AC 124 ms
55,400 KB
testcase_03 AC 123 ms
55,456 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 123 ms
55,400 KB
testcase_07 AC 122 ms
55,740 KB
testcase_08 AC 122 ms
55,616 KB
testcase_09 AC 121 ms
55,420 KB
testcase_10 AC 121 ms
55,688 KB
testcase_11 AC 122 ms
55,736 KB
testcase_12 AC 123 ms
56,072 KB
testcase_13 AC 123 ms
55,736 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

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