結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー | Mcpu3 |
提出日時 | 2020-04-04 22:20:17 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,333 bytes |
コンパイル時間 | 2,148 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 56,540 KB |
最終ジャッジ日時 | 2024-07-03 07:48:20 |
合計ジャッジ時間 | 23,050 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 164 ms
55,472 KB |
testcase_01 | AC | 137 ms
54,440 KB |
testcase_02 | AC | 124 ms
53,828 KB |
testcase_03 | AC | 133 ms
54,104 KB |
testcase_04 | AC | 133 ms
54,400 KB |
testcase_05 | AC | 139 ms
54,912 KB |
testcase_06 | AC | 131 ms
54,516 KB |
testcase_07 | AC | 138 ms
54,256 KB |
testcase_08 | AC | 140 ms
54,404 KB |
testcase_09 | AC | 144 ms
54,356 KB |
testcase_10 | AC | 137 ms
54,384 KB |
testcase_11 | AC | 132 ms
54,624 KB |
testcase_12 | AC | 134 ms
54,564 KB |
testcase_13 | AC | 128 ms
54,196 KB |
testcase_14 | AC | 142 ms
54,300 KB |
testcase_15 | AC | 140 ms
54,372 KB |
testcase_16 | AC | 141 ms
54,460 KB |
testcase_17 | AC | 133 ms
54,208 KB |
testcase_18 | AC | 134 ms
54,176 KB |
testcase_19 | AC | 135 ms
56,212 KB |
testcase_20 | AC | 127 ms
53,752 KB |
testcase_21 | AC | 143 ms
54,264 KB |
testcase_22 | AC | 138 ms
54,400 KB |
testcase_23 | AC | 130 ms
53,984 KB |
testcase_24 | AC | 137 ms
54,132 KB |
testcase_25 | AC | 135 ms
54,484 KB |
testcase_26 | AC | 134 ms
54,444 KB |
testcase_27 | AC | 138 ms
54,504 KB |
testcase_28 | AC | 119 ms
53,580 KB |
testcase_29 | AC | 135 ms
54,372 KB |
testcase_30 | AC | 135 ms
54,264 KB |
testcase_31 | AC | 134 ms
54,364 KB |
testcase_32 | AC | 135 ms
54,080 KB |
testcase_33 | AC | 136 ms
54,616 KB |
testcase_34 | AC | 166 ms
55,308 KB |
testcase_35 | AC | 147 ms
55,060 KB |
testcase_36 | AC | 170 ms
55,312 KB |
testcase_37 | AC | 166 ms
55,380 KB |
testcase_38 | AC | 166 ms
55,272 KB |
testcase_39 | AC | 177 ms
55,472 KB |
testcase_40 | AC | 165 ms
55,372 KB |
testcase_41 | AC | 168 ms
55,124 KB |
testcase_42 | AC | 176 ms
54,996 KB |
testcase_43 | AC | 169 ms
55,536 KB |
testcase_44 | AC | 164 ms
55,284 KB |
testcase_45 | AC | 162 ms
55,196 KB |
testcase_46 | AC | 168 ms
55,584 KB |
testcase_47 | AC | 160 ms
54,992 KB |
testcase_48 | AC | 160 ms
55,100 KB |
testcase_49 | AC | 163 ms
55,080 KB |
testcase_50 | AC | 171 ms
55,284 KB |
testcase_51 | AC | 166 ms
55,400 KB |
testcase_52 | AC | 176 ms
55,440 KB |
testcase_53 | AC | 160 ms
55,356 KB |
testcase_54 | AC | 159 ms
55,468 KB |
testcase_55 | AC | 162 ms
55,076 KB |
testcase_56 | AC | 165 ms
55,280 KB |
testcase_57 | AC | 162 ms
55,224 KB |
testcase_58 | RE | - |
testcase_59 | RE | - |
testcase_60 | AC | 135 ms
54,512 KB |
testcase_61 | AC | 136 ms
54,340 KB |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | AC | 137 ms
54,212 KB |
testcase_65 | RE | - |
testcase_66 | AC | 134 ms
54,068 KB |
testcase_67 | RE | - |
testcase_68 | AC | 143 ms
54,184 KB |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | AC | 140 ms
54,572 KB |
testcase_72 | AC | 138 ms
54,340 KB |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | AC | 135 ms
54,160 KB |
testcase_76 | AC | 140 ms
54,168 KB |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | AC | 137 ms
54,252 KB |
testcase_81 | RE | - |
testcase_82 | AC | 138 ms
54,300 KB |
testcase_83 | AC | 140 ms
54,752 KB |
testcase_84 | AC | 137 ms
54,412 KB |
testcase_85 | AC | 135 ms
54,508 KB |
testcase_86 | AC | 136 ms
54,124 KB |
testcase_87 | AC | 140 ms
54,624 KB |
testcase_88 | AC | 139 ms
54,376 KB |
testcase_89 | AC | 146 ms
54,332 KB |
testcase_90 | AC | 126 ms
54,000 KB |
testcase_91 | AC | 140 ms
54,256 KB |
testcase_92 | AC | 138 ms
54,624 KB |
testcase_93 | AC | 137 ms
54,476 KB |
testcase_94 | AC | 140 ms
54,792 KB |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | AC | 137 ms
54,192 KB |
testcase_98 | AC | 141 ms
54,440 KB |
testcase_99 | RE | - |
testcase_100 | AC | 138 ms
54,364 KB |
testcase_101 | AC | 135 ms
54,272 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 | 167 ms
55,328 KB |
testcase_123 | AC | 166 ms
55,384 KB |
testcase_124 | AC | 163 ms
55,464 KB |
ソースコード
import java.math.BigDecimal; import java.math.MathContext; import java.util.Arrays; 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) { BigDecimal[] e = new BigDecimal[2]; e[0] = BigDecimal.ZERO.subtract(d.sqrt(MathContext.DECIMAL128)).subtract(b).divide(a.multiply(new BigDecimal(2))); e[1] = d.sqrt(MathContext.DECIMAL128).subtract(b).divide(a.multiply(new BigDecimal(2))); Arrays.sort(e); System.out.print(2 + "\n" + e[0].toPlainString() + '\n' + e[1].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); } } }