結果
| 問題 | 
                            No.1042 愚直大学
                             | 
                    
| コンテスト | |
| ユーザー | 
                             integer
                         | 
                    
| 提出日時 | 2020-05-04 19:19:06 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 624 bytes | 
| コンパイル時間 | 298 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-06-24 21:06:26 | 
| 合計ジャッジ時間 | 1,775 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 2 | 
| other | WA * 23 | 
ソースコード
import math
import sys
sys.setrecursionlimit(100000)
p, q = 0, 0
def main():
    global p, q
    p, q = map(int, input().split())
    ans = solve()
    print(ans)
def f(n):
    return n * n - q * n * math.log2(n) - p
def solve():
    return binaryserch(f, 0, 10 ** 100)
def binaryserch(func, _min, _max):
    print(_min, _max)
    tmp = (_min + _max) / 2
    ans = func(tmp)
   #print('ans', tmp, ans)
    if _max - _min < 10 ** -5:
        return tmp
    if ans > 0:
        return binaryserch(func, _min, tmp)
    elif func(tmp) < 0:
        return binaryserch(func, tmp, _max)
if __name__ == '__main__':
    main()
            
            
            
        
            
integer