結果
| 問題 |
No.2970 三次関数の絶対値
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-07 10:09:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,948 ms / 2,000 ms |
| コード長 | 687 bytes |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 62,336 KB |
| 最終ジャッジ日時 | 2024-12-07 10:11:12 |
| 合計ジャッジ時間 | 100,867 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
import time
import random
class Timer:
def __init__(self, timelimit):
self.start_time = time.time()
self.timelimit = timelimit
def timeover(self):
return (time.time() - self.start_time) >= self.timelimit
def elapsed(self):
return time.time() - self.start_time
def f(x, c):
return c[0] + c[1] * x + c[2] * x * x + c[3] * x * x * x
def main():
c = list(map(int, input().split()))
l, r = list(map(int, input().split()))
timer = Timer(1.9)
ans = float("inf")
while not timer.timeover():
x = random.uniform(l, r)
ans = min(ans, abs(f(x, c)))
print(ans)
if __name__ == "__main__":
main()