結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー | Mcpu3 |
提出日時 | 2020-04-04 22:26:08 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 1,429 bytes |
コンパイル時間 | 2,407 ms |
コンパイル使用メモリ | 89,272 KB |
実行使用メモリ | 55,556 KB |
最終ジャッジ日時 | 2024-07-03 07:49:01 |
合計ジャッジ時間 | 22,970 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 166 ms
55,424 KB |
testcase_01 | AC | 138 ms
54,420 KB |
testcase_02 | AC | 134 ms
54,516 KB |
testcase_03 | AC | 136 ms
54,324 KB |
testcase_04 | AC | 139 ms
54,344 KB |
testcase_05 | AC | 129 ms
54,392 KB |
testcase_06 | AC | 132 ms
54,500 KB |
testcase_07 | AC | 140 ms
54,604 KB |
testcase_08 | AC | 138 ms
54,540 KB |
testcase_09 | AC | 131 ms
53,592 KB |
testcase_10 | AC | 139 ms
54,492 KB |
testcase_11 | AC | 142 ms
54,344 KB |
testcase_12 | AC | 137 ms
54,128 KB |
testcase_13 | AC | 142 ms
54,688 KB |
testcase_14 | AC | 141 ms
54,384 KB |
testcase_15 | AC | 139 ms
54,372 KB |
testcase_16 | AC | 141 ms
54,408 KB |
testcase_17 | AC | 145 ms
54,272 KB |
testcase_18 | AC | 140 ms
54,472 KB |
testcase_19 | AC | 139 ms
54,308 KB |
testcase_20 | AC | 138 ms
54,484 KB |
testcase_21 | AC | 139 ms
54,436 KB |
testcase_22 | AC | 138 ms
54,280 KB |
testcase_23 | AC | 134 ms
54,272 KB |
testcase_24 | AC | 124 ms
54,460 KB |
testcase_25 | AC | 135 ms
54,516 KB |
testcase_26 | AC | 137 ms
54,432 KB |
testcase_27 | AC | 135 ms
54,300 KB |
testcase_28 | AC | 136 ms
54,632 KB |
testcase_29 | AC | 135 ms
54,496 KB |
testcase_30 | AC | 133 ms
54,296 KB |
testcase_31 | AC | 136 ms
54,424 KB |
testcase_32 | AC | 137 ms
54,120 KB |
testcase_33 | AC | 135 ms
54,216 KB |
testcase_34 | AC | 152 ms
55,128 KB |
testcase_35 | AC | 166 ms
55,172 KB |
testcase_36 | AC | 175 ms
55,296 KB |
testcase_37 | AC | 164 ms
55,264 KB |
testcase_38 | AC | 167 ms
55,272 KB |
testcase_39 | AC | 166 ms
55,112 KB |
testcase_40 | AC | 165 ms
55,480 KB |
testcase_41 | AC | 168 ms
55,244 KB |
testcase_42 | AC | 150 ms
55,324 KB |
testcase_43 | AC | 164 ms
55,248 KB |
testcase_44 | AC | 166 ms
55,248 KB |
testcase_45 | AC | 167 ms
55,364 KB |
testcase_46 | AC | 164 ms
55,356 KB |
testcase_47 | AC | 158 ms
55,300 KB |
testcase_48 | AC | 160 ms
55,044 KB |
testcase_49 | AC | 163 ms
54,780 KB |
testcase_50 | AC | 165 ms
55,268 KB |
testcase_51 | AC | 160 ms
55,160 KB |
testcase_52 | AC | 166 ms
55,336 KB |
testcase_53 | AC | 159 ms
54,904 KB |
testcase_54 | AC | 161 ms
55,436 KB |
testcase_55 | AC | 154 ms
55,176 KB |
testcase_56 | AC | 164 ms
55,424 KB |
testcase_57 | AC | 148 ms
55,460 KB |
testcase_58 | AC | 168 ms
55,156 KB |
testcase_59 | AC | 164 ms
55,500 KB |
testcase_60 | AC | 141 ms
54,324 KB |
testcase_61 | AC | 141 ms
54,564 KB |
testcase_62 | AC | 169 ms
55,184 KB |
testcase_63 | AC | 173 ms
55,556 KB |
testcase_64 | AC | 138 ms
54,400 KB |
testcase_65 | AC | 170 ms
55,180 KB |
testcase_66 | AC | 144 ms
54,408 KB |
testcase_67 | AC | 169 ms
55,316 KB |
testcase_68 | AC | 141 ms
54,448 KB |
testcase_69 | AC | 167 ms
55,168 KB |
testcase_70 | AC | 170 ms
55,444 KB |
testcase_71 | AC | 137 ms
54,420 KB |
testcase_72 | AC | 134 ms
54,216 KB |
testcase_73 | AC | 166 ms
55,284 KB |
testcase_74 | AC | 165 ms
55,112 KB |
testcase_75 | AC | 136 ms
54,324 KB |
testcase_76 | AC | 138 ms
54,656 KB |
testcase_77 | AC | 164 ms
55,356 KB |
testcase_78 | AC | 163 ms
55,312 KB |
testcase_79 | AC | 163 ms
55,124 KB |
testcase_80 | AC | 134 ms
54,344 KB |
testcase_81 | AC | 162 ms
55,172 KB |
testcase_82 | AC | 143 ms
54,228 KB |
testcase_83 | AC | 139 ms
54,644 KB |
testcase_84 | AC | 135 ms
54,440 KB |
testcase_85 | AC | 135 ms
54,736 KB |
testcase_86 | AC | 133 ms
54,664 KB |
testcase_87 | AC | 137 ms
54,244 KB |
testcase_88 | AC | 133 ms
54,328 KB |
testcase_89 | AC | 133 ms
54,516 KB |
testcase_90 | AC | 134 ms
54,576 KB |
testcase_91 | AC | 124 ms
53,588 KB |
testcase_92 | AC | 136 ms
54,272 KB |
testcase_93 | AC | 132 ms
54,636 KB |
testcase_94 | AC | 141 ms
54,416 KB |
testcase_95 | AC | 134 ms
54,424 KB |
testcase_96 | AC | 136 ms
54,260 KB |
testcase_97 | AC | 136 ms
54,600 KB |
testcase_98 | AC | 139 ms
54,156 KB |
testcase_99 | AC | 140 ms
54,284 KB |
testcase_100 | AC | 140 ms
54,280 KB |
testcase_101 | AC | 126 ms
53,772 KB |
testcase_102 | AC | 136 ms
54,444 KB |
testcase_103 | AC | 133 ms
54,440 KB |
testcase_104 | AC | 133 ms
54,428 KB |
testcase_105 | AC | 133 ms
54,484 KB |
testcase_106 | AC | 132 ms
54,436 KB |
testcase_107 | AC | 131 ms
54,544 KB |
testcase_108 | AC | 134 ms
54,288 KB |
testcase_109 | AC | 144 ms
54,336 KB |
testcase_110 | AC | 137 ms
54,448 KB |
testcase_111 | AC | 139 ms
54,528 KB |
testcase_112 | AC | 137 ms
54,400 KB |
testcase_113 | AC | 137 ms
54,260 KB |
testcase_114 | AC | 137 ms
54,368 KB |
testcase_115 | AC | 135 ms
54,456 KB |
testcase_116 | AC | 133 ms
54,476 KB |
testcase_117 | AC | 135 ms
54,692 KB |
testcase_118 | AC | 138 ms
54,360 KB |
testcase_119 | AC | 133 ms
54,416 KB |
testcase_120 | AC | 133 ms
54,384 KB |
testcase_121 | AC | 128 ms
54,480 KB |
testcase_122 | AC | 158 ms
55,216 KB |
testcase_123 | AC | 162 ms
55,416 KB |
testcase_124 | AC | 166 ms
55,372 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, MathContext.DECIMAL128).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)), MathContext.DECIMAL128); e[1] = d.sqrt(MathContext.DECIMAL128).subtract(b).divide(a.multiply(new BigDecimal(2)), MathContext.DECIMAL128); 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)), MathContext.DECIMAL128)); } else System.out.print(0); } } }