結果

問題 No.1132 凸凹
ユーザー kotatsugame
提出日時 2020-07-27 01:07:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 63,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:46:44
合計ジャッジ時間 1,316 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long a,b,c,d,p,q;
long f(long x)
{
	return a*x*x*x+b*x*x+c*x+d;
}
main()
{
	cin>>a>>b>>c>>d>>p>>q;
	long m,mx=p,M,Mx=p;
	m=M=f(p);
	for(long x=p+1;x<=q;x++)
	{
		if(m>f(x))
		{
			m=f(x);
			mx=x;
		}
		if(M<f(x))
		{
			M=f(x);
			Mx=x;
		}
	}
	cout<<M<<" "<<Mx<<" "<<m<<" "<<mx<<endl;
}
0