結果

問題 No.955 ax^2+bx+c=0
ユーザー Mcpu3Mcpu3
提出日時 2020-04-04 21:58:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 74,488 KB
実行使用メモリ 58,648 KB
最終ジャッジ日時 2023-09-16 06:13:50
合計ジャッジ時間 25,195 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
56,500 KB
testcase_01 AC 142 ms
56,176 KB
testcase_02 AC 137 ms
55,840 KB
testcase_03 AC 137 ms
55,820 KB
testcase_04 AC 138 ms
56,280 KB
testcase_05 AC 136 ms
56,048 KB
testcase_06 AC 138 ms
56,412 KB
testcase_07 AC 138 ms
55,892 KB
testcase_08 AC 138 ms
56,264 KB
testcase_09 AC 139 ms
56,132 KB
testcase_10 AC 141 ms
55,896 KB
testcase_11 AC 143 ms
56,484 KB
testcase_12 AC 136 ms
56,140 KB
testcase_13 AC 135 ms
56,196 KB
testcase_14 AC 136 ms
55,864 KB
testcase_15 AC 138 ms
56,120 KB
testcase_16 AC 136 ms
56,224 KB
testcase_17 AC 135 ms
56,536 KB
testcase_18 AC 134 ms
55,996 KB
testcase_19 AC 137 ms
55,856 KB
testcase_20 AC 134 ms
56,236 KB
testcase_21 AC 136 ms
54,436 KB
testcase_22 AC 136 ms
54,212 KB
testcase_23 AC 138 ms
58,456 KB
testcase_24 AC 137 ms
56,284 KB
testcase_25 AC 138 ms
56,304 KB
testcase_26 AC 136 ms
56,064 KB
testcase_27 AC 138 ms
56,248 KB
testcase_28 AC 143 ms
56,492 KB
testcase_29 AC 139 ms
56,052 KB
testcase_30 AC 139 ms
56,296 KB
testcase_31 AC 140 ms
56,376 KB
testcase_32 AC 136 ms
56,136 KB
testcase_33 AC 138 ms
56,616 KB
testcase_34 AC 163 ms
55,952 KB
testcase_35 AC 140 ms
56,528 KB
testcase_36 AC 140 ms
56,436 KB
testcase_37 AC 141 ms
56,752 KB
testcase_38 AC 140 ms
56,572 KB
testcase_39 AC 141 ms
56,032 KB
testcase_40 AC 142 ms
56,384 KB
testcase_41 AC 140 ms
56,208 KB
testcase_42 AC 140 ms
56,360 KB
testcase_43 AC 142 ms
56,128 KB
testcase_44 AC 140 ms
56,572 KB
testcase_45 AC 140 ms
55,756 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 136 ms
56,120 KB
testcase_61 AC 139 ms
56,216 KB
testcase_62 RE -
testcase_63 RE -
testcase_64 AC 138 ms
56,088 KB
testcase_65 RE -
testcase_66 AC 137 ms
54,620 KB
testcase_67 RE -
testcase_68 AC 139 ms
56,316 KB
testcase_69 RE -
testcase_70 RE -
testcase_71 AC 136 ms
56,136 KB
testcase_72 AC 137 ms
56,396 KB
testcase_73 RE -
testcase_74 RE -
testcase_75 AC 138 ms
56,256 KB
testcase_76 AC 144 ms
56,132 KB
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 AC 138 ms
56,348 KB
testcase_81 RE -
testcase_82 AC 140 ms
56,156 KB
testcase_83 AC 140 ms
56,140 KB
testcase_84 AC 139 ms
56,080 KB
testcase_85 AC 140 ms
56,140 KB
testcase_86 AC 142 ms
56,204 KB
testcase_87 AC 141 ms
56,208 KB
testcase_88 AC 143 ms
56,284 KB
testcase_89 AC 141 ms
56,048 KB
testcase_90 AC 149 ms
56,176 KB
testcase_91 AC 141 ms
56,252 KB
testcase_92 AC 146 ms
56,468 KB
testcase_93 AC 143 ms
56,400 KB
testcase_94 AC 144 ms
56,240 KB
testcase_95 RE -
testcase_96 RE -
testcase_97 AC 136 ms
56,364 KB
testcase_98 AC 137 ms
56,052 KB
testcase_99 RE -
testcase_100 AC 138 ms
56,496 KB
testcase_101 AC 136 ms
56,356 KB
testcase_102 RE -
testcase_103 RE -
testcase_104 RE -
testcase_105 RE -
testcase_106 RE -
testcase_107 RE -
testcase_108 RE -
testcase_109 RE -
testcase_110 RE -
testcase_111 RE -
testcase_112 RE -
testcase_113 RE -
testcase_114 RE -
testcase_115 RE -
testcase_116 RE -
testcase_117 RE -
testcase_118 RE -
testcase_119 RE -
testcase_120 RE -
testcase_121 RE -
testcase_122 AC 142 ms
56,008 KB
testcase_123 AC 144 ms
56,304 KB
testcase_124 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		BigDecimal a = scanner.nextBigDecimal(), b = scanner.nextBigDecimal(), c = scanner.nextBigDecimal();
		if (a.equals(BigDecimal.ZERO)) {
			if (b.equals(BigDecimal.ZERO)) {
				if (c.equals(BigDecimal.ZERO)) System.out.print(-1);
				else System.out.print(0);
			}
			else {
				System.out.println(1);
				System.out.print(BigDecimal.ZERO.subtract(c).divide(b).toPlainString());
			}
		}
		else {
			BigDecimal d = b.multiply(b).subtract(a.multiply(c).multiply(new BigDecimal(4)));
			if (d.compareTo(BigDecimal.ZERO) == 1) {
				System.out.println(2);
				System.out.println((BigDecimal.ZERO.subtract(d.sqrt(MathContext.DECIMAL128)).subtract(b)).divide(a.multiply(new BigDecimal(2))).toPlainString());
				System.out.print((d.sqrt(MathContext.DECIMAL128).subtract(b)).divide(a.multiply(new BigDecimal(2))).toPlainString());
			}
			else if (d.equals(BigDecimal.ZERO)) {
				System.out.println(1);
				System.out.print(BigDecimal.ZERO.subtract(b).divide(a.multiply(new BigDecimal(2))));
			}
			else System.out.print(0);
		}
	}
}
0