結果

問題 No.1132 凸凹
ユーザー tentententen
提出日時 2020-08-17 22:41:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 1,942 ms
コンパイル使用メモリ 86,496 KB
実行使用メモリ 55,324 KB
最終ジャッジ日時 2024-04-19 19:16:43
合計ジャッジ時間 6,944 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
54,732 KB
testcase_01 AC 157 ms
55,168 KB
testcase_02 AC 145 ms
55,216 KB
testcase_03 AC 134 ms
55,032 KB
testcase_04 AC 136 ms
54,832 KB
testcase_05 AC 151 ms
55,120 KB
testcase_06 AC 143 ms
54,880 KB
testcase_07 AC 154 ms
55,296 KB
testcase_08 AC 138 ms
54,508 KB
testcase_09 AC 136 ms
54,744 KB
testcase_10 AC 149 ms
55,280 KB
testcase_11 AC 134 ms
54,668 KB
testcase_12 AC 126 ms
54,760 KB
testcase_13 AC 145 ms
55,236 KB
testcase_14 AC 137 ms
54,788 KB
testcase_15 AC 145 ms
55,184 KB
testcase_16 AC 133 ms
55,016 KB
testcase_17 AC 133 ms
54,644 KB
testcase_18 AC 131 ms
54,988 KB
testcase_19 AC 141 ms
54,784 KB
testcase_20 AC 144 ms
55,132 KB
testcase_21 AC 149 ms
55,228 KB
testcase_22 AC 141 ms
55,252 KB
testcase_23 AC 133 ms
54,552 KB
testcase_24 AC 140 ms
55,168 KB
testcase_25 AC 148 ms
55,136 KB
testcase_26 AC 144 ms
55,164 KB
testcase_27 AC 149 ms
55,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		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();
		long max = Long.MIN_VALUE;
		long maxValue = 0;
		long min = Long.MAX_VALUE;
		long minValue = 0;
		for (long i = p; i <= q; i++) {
		    long value = i * i * i * a + i * i * b + i * c + d;
		    if (max < value) {
		        max = value;
		        maxValue = i;
		    }
		    if (min > value) {
		        min = value;
		        minValue = i;
		    }
		}
		System.out.println(max + " " + maxValue + " " + min + " " + minValue);
	}
}
0