結果
| 問題 |
No.1381 Simple Geometry 1
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-02-07 21:06:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 1,044 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-07-04 14:18:41 |
| 合計ジャッジ時間 | 2,197 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
def General_Binary_Increase_Search(L,R,cond,Integer=True,ep=1/(1<<20),Times=50):
"""条件式が単調増加であるとき,一般的な二部探索を行う.
L:解の下限
R:解の上限
cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす)
Integer:解を整数に制限するか?
ep:Integer=Falseのとき,解の許容する誤差
"""
if not(cond(R)):
return None
if cond(L):
return L
if Integer:
R+=1
while R-L>1:
C=L+(R-L)//2
if cond(C):
R=C
else:
L=C
return R
else:
while (R-L)>=ep and Times:
Times-=1
C=L+(R-L)/2
if cond(C):
R=C
else:
L=C
return R
from math import sqrt
def f(s):
t=X/s
return sqrt(s*s+Y*Y)-sqrt(t*t+Z*Z)>=W
X,Y,Z,W=map(int,input().split())
s=General_Binary_Increase_Search(0.00001,10**12,f,False,Times=100)
t=X/s
print(abs(Y*Z-s*t)/2)
Kazun