結果

問題 No.1042 愚直大学
ユーザー はむ吉🐹はむ吉🐹
提出日時 2020-05-01 22:11:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 454 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 101,940 KB
最終ジャッジ日時 2023-08-26 14:17:17
合計ジャッジ時間 13,573 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,280 ms
55,852 KB
testcase_01 AC 316 ms
56,060 KB
testcase_02 AC 315 ms
56,004 KB
testcase_03 RE -
testcase_04 AC 310 ms
56,220 KB
testcase_05 AC 313 ms
56,188 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 317 ms
56,116 KB
testcase_10 RE -
testcase_11 AC 313 ms
56,120 KB
testcase_12 AC 316 ms
56,188 KB
testcase_13 AC 309 ms
56,136 KB
testcase_14 AC 308 ms
56,132 KB
testcase_15 AC 309 ms
56,156 KB
testcase_16 AC 302 ms
56,248 KB
testcase_17 AC 303 ms
56,040 KB
testcase_18 AC 306 ms
56,128 KB
testcase_19 AC 308 ms
56,116 KB
testcase_20 AC 310 ms
56,164 KB
testcase_21 AC 314 ms
56,176 KB
testcase_22 AC 317 ms
56,208 KB
testcase_23 AC 307 ms
56,152 KB
testcase_24 AC 307 ms
101,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import numpy
import scipy.optimize
import sys


def generate_func(p, q):
    def f(n):
        return p + q * n * numpy.log2(n) - numpy.square(n)
    return f


def find_root(p, q):
    sol = scipy.optimize.brentq(generate_func(p, q), 1, sys.maxsize / 10)
    return sol


def main():
    p, q = (float(z) for z in input().split())
    res = find_root(p, q)
    print("{:.8f}".format(res))


if __name__ == "__main__":
    main()
0