結果
問題 | No.1980 [Cherry 4th Tune D] 停止距離 |
ユーザー |
👑 ![]() |
提出日時 | 2022-03-15 01:38:09 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,519 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 82,032 KB |
実行使用メモリ | 89,652 KB |
最終ジャッジ日時 | 2024-10-09 06:23:56 |
合計ジャッジ時間 | 7,831 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 24 |
ソースコード
def General_Binary_Decrease_Search_Integer(L,R,cond,default=None): """条件式が単調減少であるとき, 整数上で二部探索を行う. L:解の下限 R:解の上限 cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす) default: Rで条件を満たさないときの返り値 """ if not(cond(L)): return default if cond(R): return R L-=1 while R-L>1: C=L+(R-L)//2 if cond(C): L=C else: R=C return L #小数点以下第 k 位まで与えられる小数を 10^k 倍する. def Decimal_to_Int(s: str, k: int, base=10): """ s*10^k を整数で出力する. s: 小数点を含むかもしれない数 k: 小数点以下高々何位までか? base: 基数 """ if "." not in s: return int(s,base)*pow(base,k) m=s.index(".") return int(s.replace(".",""))*pow(base,k-(len(s)-m-1)) #================================================== def answer(X): a,b=divmod(X,100) return str(a)+"."+str(b).zfill(2) #================================================== import sys input=sys.stdin.readline write=sys.stdout.write N=int(input()) Ans=[None]*N for n in range(N): T,mu,L=input()[:-1].split() T_100=Decimal_to_Int(T,2) mu_100=Decimal_to_Int(mu,2) L_100=Decimal_to_Int(L,2) check=lambda w:w*(25*w+18*T_100*mu_100)<=6480*mu_100*L_100 V_100=0 while check(V_100): V_100+=1 V_100-=1 Ans[n]=answer(V_100) write("\n".join(Ans))