結果

問題 No.1042 愚直大学
ユーザー strangerxxxstrangerxxx
提出日時 2020-05-02 02:03:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 11,104 KB
実行使用メモリ 8,540 KB
最終ジャッジ日時 2023-08-26 20:33:50
合計ジャッジ時間 2,126 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,248 KB
testcase_01 AC 16 ms
8,360 KB
testcase_02 AC 15 ms
8,248 KB
testcase_03 AC 15 ms
8,284 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
8,448 KB
testcase_07 AC 15 ms
8,256 KB
testcase_08 AC 16 ms
8,392 KB
testcase_09 AC 15 ms
8,392 KB
testcase_10 AC 15 ms
8,492 KB
testcase_11 AC 14 ms
8,380 KB
testcase_12 AC 15 ms
8,444 KB
testcase_13 AC 96 ms
8,436 KB
testcase_14 AC 15 ms
8,436 KB
testcase_15 AC 16 ms
8,280 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 15 ms
8,268 KB
testcase_19 WA -
testcase_20 AC 95 ms
8,332 KB
testcase_21 AC 93 ms
8,256 KB
testcase_22 AC 15 ms
8,420 KB
testcase_23 AC 15 ms
8,196 KB
testcase_24 AC 16 ms
8,488 KB
権限があれば一括ダウンロードができます

ソースコード

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 ** 10
half = right / 2
eps = 10 ** (-6)
while i < 10 ** 5:
    diff = f(half)
    if abs(diff) < eps:
        break
    elif diff > 0:
        right = half
        half = (left + right) / 2
    else:
        left = half
        half = (left + right) / 2
    i += 1
print(half)
0