結果

問題 No.1132 凸凹
ユーザー RISE70226821RISE70226821
提出日時 2020-08-04 09:29:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 73,752 KB
実行使用メモリ 58,880 KB
最終ジャッジ日時 2023-10-12 07:53:44
合計ジャッジ時間 9,075 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
57,004 KB
testcase_01 AC 176 ms
56,704 KB
testcase_02 AC 175 ms
57,076 KB
testcase_03 AC 173 ms
57,328 KB
testcase_04 AC 173 ms
56,824 KB
testcase_05 AC 175 ms
56,952 KB
testcase_06 AC 172 ms
56,872 KB
testcase_07 AC 175 ms
56,844 KB
testcase_08 AC 177 ms
56,764 KB
testcase_09 AC 177 ms
57,216 KB
testcase_10 AC 176 ms
56,768 KB
testcase_11 AC 174 ms
56,884 KB
testcase_12 AC 176 ms
56,884 KB
testcase_13 AC 178 ms
56,852 KB
testcase_14 AC 176 ms
56,936 KB
testcase_15 AC 175 ms
56,768 KB
testcase_16 AC 174 ms
56,856 KB
testcase_17 AC 177 ms
56,496 KB
testcase_18 AC 175 ms
56,912 KB
testcase_19 AC 173 ms
56,728 KB
testcase_20 AC 176 ms
56,612 KB
testcase_21 AC 176 ms
56,896 KB
testcase_22 AC 176 ms
56,848 KB
testcase_23 AC 175 ms
56,864 KB
testcase_24 AC 173 ms
56,856 KB
testcase_25 AC 176 ms
56,808 KB
testcase_26 AC 174 ms
58,880 KB
testcase_27 AC 175 ms
56,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int p = sc.nextInt();
		int q = sc.nextInt();
		
		// 算出
		int maxHeight = Integer.MIN_VALUE;
		int maxX = 0;
		int minHeight = Integer.MAX_VALUE;
		int minX = 0;
		
		for(int x = p; x <= q; x++){
			int height = a*x*x*x + b*x*x + c*x + d;
			if(maxHeight < height){
				maxHeight = height;
				maxX = x;
			}
			if(height < minHeight){
				minHeight = height;
				minX = x;
			}
		}
		
		// 出力
		System.out.println(maxHeight + " " + maxX + " " + minHeight + " " + minX);
	}
}
0