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