結果

問題 No.1132 凸凹
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-19 14:49:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,133 bytes
コンパイル時間 3,838 ms
コンパイル使用メモリ 79,612 KB
実行使用メモリ 42,856 KB
最終ジャッジ日時 2024-04-29 07:52:38
合計ジャッジ時間 9,308 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
42,084 KB
testcase_01 AC 162 ms
42,540 KB
testcase_02 AC 157 ms
42,236 KB
testcase_03 AC 165 ms
42,648 KB
testcase_04 AC 164 ms
42,624 KB
testcase_05 AC 161 ms
42,672 KB
testcase_06 AC 168 ms
42,596 KB
testcase_07 WA -
testcase_08 AC 150 ms
42,100 KB
testcase_09 AC 162 ms
42,432 KB
testcase_10 AC 161 ms
42,284 KB
testcase_11 WA -
testcase_12 AC 148 ms
42,016 KB
testcase_13 AC 147 ms
42,216 KB
testcase_14 WA -
testcase_15 AC 165 ms
42,284 KB
testcase_16 AC 155 ms
41,932 KB
testcase_17 WA -
testcase_18 AC 166 ms
42,576 KB
testcase_19 WA -
testcase_20 AC 162 ms
42,468 KB
testcase_21 WA -
testcase_22 AC 160 ms
42,736 KB
testcase_23 AC 163 ms
42,588 KB
testcase_24 WA -
testcase_25 AC 149 ms
42,252 KB
testcase_26 AC 164 ms
42,648 KB
testcase_27 AC 165 ms
42,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class HelloWorld {
		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();
			sc.close();

			int x1 = (int)(-b + Math.sqrt(b * b - 3 * a * c));
			int x2 = (int)(-b + Math.sqrt(b * b - 3 * a * c));

			int start = a*p*p*p + b*p*p + c*p + d;
			int end = a*q*q*q + b*q*q + c*q + d;
			int y1 = a*x1*x1*x1 + b*x1*x1 + c*x1 + d;
			int y2 = a*x2*x2*x2 + b*x2*x2 + c*x2 + d;

			int max = start > end ? start : end;
			int max_x = start > end ? p : q;
			int min = start > end? end : start;
			int min_x =start > end ? q : p;
			if (y1 > p && y1 < q) {
				max = max > y1 ? max : y1;
				min = y1 > min ? min : y1;
				max_x = max > y1 ? max_x : x1;
				min_x = y1 > min ? min_x : x1;
			}
			if (y2 > p && y2 < q) {
				max = max > y2 ? max : y2;
				min = y2 > min ? min : y2;
				max_x = max > y2 ? max_x : x2;
				min_x = y2 > min ? min_x : x2;
			}

			System.out.println(max + " " + max_x + " " + min + " " + min_x);

	}
}
0