結果

問題 No.1132 凸凹
ユーザー lam6er
提出日時 2025-03-20 18:42:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 82,704 KB
実行使用メモリ 53,560 KB
最終ジャッジ日時 2025-03-20 18:42:45
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c, d, p, q = map(int, input().split())

max_val = None
min_val = None
x_max = p
x_min = p

for x in range(p, q + 1):
    current = a * x ** 3 + b * x ** 2 + c * x + d
    if max_val is None:  # Initialization
        max_val = current
        min_val = current
        x_max = x
        x_min = x
    else:
        if current > max_val:
            max_val = current
            x_max = x
        if current < min_val:
            min_val = current
            x_min = x

print(f"{max_val} {x_max} {min_val} {x_min}")
0