結果

問題 No.1042 愚直大学
ユーザー strangerxxxstrangerxxx
提出日時 2020-05-02 02:17:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 389 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 11,136 KB
実行使用メモリ 12,764 KB
最終ジャッジ日時 2023-08-26 20:58:48
合計ジャッジ時間 4,113 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
12,648 KB
testcase_01 AC 14 ms
8,420 KB
testcase_02 AC 14 ms
8,456 KB
testcase_03 AC 13 ms
8,412 KB
testcase_04 AC 14 ms
8,468 KB
testcase_05 AC 13 ms
8,284 KB
testcase_06 AC 13 ms
8,268 KB
testcase_07 AC 13 ms
8,280 KB
testcase_08 AC 14 ms
8,368 KB
testcase_09 AC 14 ms
8,280 KB
testcase_10 AC 14 ms
8,304 KB
testcase_11 AC 13 ms
8,308 KB
testcase_12 AC 13 ms
8,268 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def f(x):
    return x ** 2 - p - q * x * math.log2(x)


p, q = map(int, input().split())
i = 0
left = 0
right = 10 ** 15
half = right / 2
eps = 10 ** (-6)
while True:
    diff = f(half)
    if abs(diff) < eps:
        break
    elif diff > 0:
        right = half
        half = (left + right) / 2
    else:
        left = half
        half = (left + right) / 2
print(half)
0