結果
問題 | No.1042 愚直大学 |
ユーザー |
|
提出日時 | 2020-05-19 22:47:22 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-01 23:10:29 |
合計ジャッジ時間 | 1,435 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
import math P,Q=map(int,input().split()) x=100000000000 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.00001: break print(x)