結果

問題 No.550 夏休みの思い出(1)
ユーザー maspy
提出日時 2020-03-23 16:51:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 558 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,480 KB
最終ジャッジ日時 2024-12-26 10:31:03
合計ジャッジ時間 34,725 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

A, B, C = map(int, read().split())
INF = 10 ** 19


def find_one_solution(f, left=-INF, right=INF):
    while left + 1 < right:
        x = (left + right) // 2
        if f(x) == 0:
            return x
        if f(x) < 0:
            left = x
        else:
            right = x


def f(x):
    return x ** 3 + A * x ** 2 + B * x + C


r = find_one_solution(f)

A += r
B += r * A


def f(x):
    return x ** 2 + A * x + B


s = find_one_solution(f, left=(-A) // 2)

t = -A - s

roots = sorted((r, s, t))

print(*roots)
0