結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
60,408 KB
testcase_01 WA -
testcase_02 AC 122 ms
55,432 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
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, 7);
      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(res1 == res2) break;
        if(res1 < res2)
          left = mid;
        else
          right = mid;
      }
      System.out.println(right);
  }
}
0