結果

問題 No.1132 凸凹
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-19 15:01:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,221 bytes
コンパイル時間 3,679 ms
コンパイル使用メモリ 79,584 KB
実行使用メモリ 43,228 KB
最終ジャッジ日時 2024-04-29 07:59:59
合計ジャッジ時間 9,668 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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))/3/a );
			int x2 = (int)((-b - Math.sqrt(b * b - 3 * a * c))/3/a);

			System.out.println(x1 + " " + x2);
			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;
			System.out.println(y1 + " " + y2);
			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 (x1 > p && x1 < 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 (x2 > p && x2 < 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