結果
| 問題 |
No.1042 愚直大学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-19 22:54:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 308 bytes |
| コンパイル時間 | 607 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-10-01 23:13:19 |
| 合計ジャッジ時間 | 1,592 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 RE * 5 |
ソースコード
import math
P,Q=map(int,input().split())
x=(P+Q)*10
def f (x):
return (x**2 - (P+Q * x *math.log2(x)))
def df (x):
return -1*((Q*math.log(x)+x*(-math.log(4))+Q)/math.log(2))
while True:
prev=x
x=x-((f(x))/df(x)) # ニュートン法
if abs(prev - x) < 0.001:
break
print(x)