結果

問題 No.955 ax^2+bx+c=0
ユーザー agataYMGTagataYMGT
提出日時 2019-12-28 10:33:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,288 bytes
コンパイル時間 4,050 ms
コンパイル使用メモリ 77,796 KB
実行使用メモリ 41,868 KB
最終ジャッジ日時 2024-04-19 14:48:04
合計ジャッジ時間 22,297 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,332 KB
testcase_01 AC 125 ms
40,124 KB
testcase_02 AC 125 ms
41,592 KB
testcase_03 AC 124 ms
41,288 KB
testcase_04 AC 124 ms
41,068 KB
testcase_05 AC 111 ms
40,976 KB
testcase_06 AC 122 ms
40,868 KB
testcase_07 AC 125 ms
41,520 KB
testcase_08 AC 126 ms
41,076 KB
testcase_09 AC 116 ms
40,784 KB
testcase_10 AC 125 ms
40,928 KB
testcase_11 AC 122 ms
40,908 KB
testcase_12 AC 116 ms
40,892 KB
testcase_13 AC 125 ms
40,944 KB
testcase_14 AC 116 ms
39,828 KB
testcase_15 AC 124 ms
40,780 KB
testcase_16 AC 111 ms
39,744 KB
testcase_17 AC 126 ms
40,956 KB
testcase_18 AC 125 ms
41,296 KB
testcase_19 AC 119 ms
40,852 KB
testcase_20 AC 111 ms
39,804 KB
testcase_21 AC 113 ms
39,800 KB
testcase_22 AC 125 ms
41,240 KB
testcase_23 AC 124 ms
41,376 KB
testcase_24 AC 125 ms
41,040 KB
testcase_25 AC 125 ms
40,748 KB
testcase_26 AC 112 ms
41,200 KB
testcase_27 AC 125 ms
41,376 KB
testcase_28 AC 122 ms
41,456 KB
testcase_29 AC 125 ms
41,328 KB
testcase_30 AC 126 ms
41,540 KB
testcase_31 AC 129 ms
41,380 KB
testcase_32 AC 121 ms
41,100 KB
testcase_33 AC 127 ms
41,308 KB
testcase_34 AC 120 ms
40,976 KB
testcase_35 AC 120 ms
40,252 KB
testcase_36 AC 115 ms
41,276 KB
testcase_37 AC 132 ms
41,580 KB
testcase_38 AC 126 ms
41,212 KB
testcase_39 AC 124 ms
40,656 KB
testcase_40 AC 130 ms
41,232 KB
testcase_41 AC 124 ms
41,284 KB
testcase_42 AC 127 ms
41,132 KB
testcase_43 AC 129 ms
41,340 KB
testcase_44 AC 115 ms
40,404 KB
testcase_45 AC 125 ms
41,352 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 RE -
testcase_59 RE -
testcase_60 AC 117 ms
41,008 KB
testcase_61 AC 123 ms
41,324 KB
testcase_62 RE -
testcase_63 RE -
testcase_64 AC 115 ms
39,828 KB
testcase_65 RE -
testcase_66 AC 127 ms
41,164 KB
testcase_67 RE -
testcase_68 AC 116 ms
40,008 KB
testcase_69 RE -
testcase_70 RE -
testcase_71 AC 127 ms
41,272 KB
testcase_72 AC 128 ms
41,560 KB
testcase_73 RE -
testcase_74 RE -
testcase_75 AC 119 ms
40,944 KB
testcase_76 AC 126 ms
41,132 KB
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 AC 124 ms
41,304 KB
testcase_81 RE -
testcase_82 AC 128 ms
40,956 KB
testcase_83 AC 124 ms
41,612 KB
testcase_84 AC 133 ms
41,348 KB
testcase_85 AC 126 ms
41,400 KB
testcase_86 AC 127 ms
41,264 KB
testcase_87 AC 122 ms
41,040 KB
testcase_88 AC 107 ms
39,632 KB
testcase_89 AC 125 ms
41,408 KB
testcase_90 AC 124 ms
41,352 KB
testcase_91 AC 127 ms
41,160 KB
testcase_92 AC 118 ms
41,072 KB
testcase_93 AC 114 ms
40,080 KB
testcase_94 AC 121 ms
40,196 KB
testcase_95 RE -
testcase_96 RE -
testcase_97 AC 113 ms
41,392 KB
testcase_98 AC 123 ms
41,448 KB
testcase_99 RE -
testcase_100 AC 111 ms
40,556 KB
testcase_101 AC 123 ms
41,172 KB
testcase_102 WA -
testcase_103 WA -
testcase_104 WA -
testcase_105 WA -
testcase_106 WA -
testcase_107 WA -
testcase_108 WA -
testcase_109 WA -
testcase_110 WA -
testcase_111 WA -
testcase_112 WA -
testcase_113 WA -
testcase_114 WA -
testcase_115 WA -
testcase_116 WA -
testcase_117 WA -
testcase_118 WA -
testcase_119 WA -
testcase_120 WA -
testcase_121 WA -
testcase_122 AC 127 ms
41,380 KB
testcase_123 AC 132 ms
41,324 KB
testcase_124 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;

public class No955 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a == 0) {
			if(b == 0) {
				if(c == 0) {
					System.out.println(-1);
					return;
				} else {
					System.out.println(0);
					return;
				}
			} else {
				System.out.println(1);
				System.out.println(-c);
				return;
			}
		}

		BigDecimal A = new BigDecimal(a);
		BigDecimal B = new BigDecimal(b);
		BigDecimal C = new BigDecimal(c);

		BigDecimal D = new BigDecimal(b);
		D = D.multiply(B).subtract(new BigDecimal(4).multiply(A).multiply(C));

		if(D.compareTo(BigDecimal.ZERO) == 1) {
			System.out.println(2);
			System.out.println(BigDecimal.ZERO.subtract(B).subtract(D.sqrt(MathContext.DECIMAL128)).divide(new BigDecimal(2)).divide(A));
			System.out.println(BigDecimal.ZERO.subtract(B).add(D.sqrt(MathContext.DECIMAL128)).divide(new BigDecimal(2)).divide(A));
		} else if(D.compareTo(BigDecimal.ZERO) == 0) {
			System.out.println(1);
			System.out.println(BigDecimal.ZERO.subtract(B).add(D.sqrt(MathContext.DECIMAL128)).divide(new BigDecimal(2)).divide(A));
		} else {
			System.out.println(0);
		}
	}

}
0