結果

問題 No.1042 愚直大学
ユーザー kit84
提出日時 2020-05-01 22:32:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 550 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 75,520 KB
最終ジャッジ日時 2024-12-25 13:08:54
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

import math
log2 = math.log2
# from collections import deque

def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    # N = int(input())
    # K = int(input())
    P,Q = linput()

    # vA = linput()
    # vB = linput()
    # S = input().rstrip()
    # mX = [linput() for _ in [0,]*N]
    # res = 0

    L, R = 1.0, 10.0**19
    M = (L+R)/2

    cnt = 0
    LMAX = 10010010
    EPS = 10.0**-8
    while cnt<LMAX and abs(R-L)>EPS:
        if M*M <= P + M*Q*log2(M):
            L = M
        else:
            R = M
        M = (L+R)/2
        cnt += 1

    res = L
    # print(res)
    print("{:.7f}".format(res))

    # print(("No","Yes")[res%2])


main()
0