結果
問題 | No.1042 愚直大学 |
ユーザー |
![]() |
提出日時 | 2020-05-04 19:20:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 45,696 KB |
最終ジャッジ日時 | 2024-06-24 21:07:13 |
合計ジャッジ時間 | 2,975 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 RE * 5 |
ソースコード
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 ** -6: return tmp if ans > 0: return binaryserch(func, _min, tmp) elif func(tmp) < 0: return binaryserch(func, tmp, _max) if __name__ == '__main__': main()