結果
問題 |
No.1132 凸凹
|
ユーザー |
|
提出日時 | 2020-07-26 22:35:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 2,043 ms |
コンパイル使用メモリ | 191,788 KB |
最終ジャッジ日時 | 2025-01-12 06:25:53 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; const long long INF=1LL<<61; lint a,b,c,d; lint f(lint x){ return a*x*x*x+b*x*x+c*x+d; } int main(){ lint p,q; cin>>a>>b>>c>>d>>p>>q; lint x_mn=p,x_mx=p; for(lint x=p;x<=q;x++){ if(f(x)<f(x_mn)) x_mn=x; if(f(x)>f(x_mx)) x_mx=x; } cout<<f(x_mx)<<' '<<x_mx<<' '<<f(x_mn)<<' '<<x_mn<<'\n'; return 0; }