結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,748 KB
testcase_01 AC 17 ms
8,240 KB
testcase_02 AC 17 ms
8,316 KB
testcase_03 AC 17 ms
8,372 KB
testcase_04 AC 16 ms
8,428 KB
testcase_05 AC 16 ms
8,360 KB
testcase_06 AC 16 ms
8,428 KB
testcase_07 AC 17 ms
8,368 KB
testcase_08 AC 16 ms
8,496 KB
testcase_09 AC 17 ms
8,312 KB
testcase_10 AC 17 ms
8,392 KB
testcase_11 AC 16 ms
8,392 KB
testcase_12 AC 16 ms
8,292 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 ** 20
half = right / 2
eps = 10 ** (-8)
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