結果
| 問題 |
No.1042 愚直大学
|
| コンテスト | |
| ユーザー |
integer
|
| 提出日時 | 2020-05-04 19:20:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 624 bytes |
| コンパイル時間 | 265 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 45,952 KB |
| 最終ジャッジ日時 | 2024-06-24 21:07:02 |
| 合計ジャッジ時間 | 4,740 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 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()
integer