結果
問題 |
No.1042 愚直大学
|
ユーザー |
![]() |
提出日時 | 2020-05-04 19:21:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-06-24 21:07:44 |
合計ジャッジ時間 | 1,841 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 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()