結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー | agataYMGT |
提出日時 | 2019-12-28 10:33:56 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,288 bytes |
コンパイル時間 | 3,838 ms |
コンパイル使用メモリ | 77,920 KB |
実行使用メモリ | 41,812 KB |
最終ジャッジ日時 | 2024-10-11 07:04:23 |
合計ジャッジ時間 | 23,878 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 136 ms
41,500 KB |
testcase_01 | AC | 136 ms
41,328 KB |
testcase_02 | AC | 134 ms
41,332 KB |
testcase_03 | AC | 131 ms
40,968 KB |
testcase_04 | AC | 132 ms
40,976 KB |
testcase_05 | AC | 130 ms
41,156 KB |
testcase_06 | AC | 133 ms
41,068 KB |
testcase_07 | AC | 131 ms
41,228 KB |
testcase_08 | AC | 132 ms
41,088 KB |
testcase_09 | AC | 128 ms
40,956 KB |
testcase_10 | AC | 133 ms
41,024 KB |
testcase_11 | AC | 133 ms
40,920 KB |
testcase_12 | AC | 132 ms
41,300 KB |
testcase_13 | AC | 132 ms
41,636 KB |
testcase_14 | AC | 133 ms
41,388 KB |
testcase_15 | AC | 134 ms
41,268 KB |
testcase_16 | AC | 122 ms
40,236 KB |
testcase_17 | AC | 133 ms
41,248 KB |
testcase_18 | AC | 133 ms
41,136 KB |
testcase_19 | AC | 131 ms
41,156 KB |
testcase_20 | AC | 133 ms
41,168 KB |
testcase_21 | AC | 134 ms
41,240 KB |
testcase_22 | AC | 133 ms
41,244 KB |
testcase_23 | AC | 134 ms
41,216 KB |
testcase_24 | AC | 135 ms
41,392 KB |
testcase_25 | AC | 133 ms
41,576 KB |
testcase_26 | AC | 132 ms
41,544 KB |
testcase_27 | AC | 133 ms
41,720 KB |
testcase_28 | AC | 135 ms
41,308 KB |
testcase_29 | AC | 134 ms
41,332 KB |
testcase_30 | AC | 134 ms
41,432 KB |
testcase_31 | AC | 133 ms
41,356 KB |
testcase_32 | AC | 134 ms
41,204 KB |
testcase_33 | AC | 135 ms
41,372 KB |
testcase_34 | AC | 136 ms
41,476 KB |
testcase_35 | AC | 135 ms
41,408 KB |
testcase_36 | AC | 135 ms
41,352 KB |
testcase_37 | AC | 139 ms
41,812 KB |
testcase_38 | AC | 135 ms
41,684 KB |
testcase_39 | AC | 137 ms
41,456 KB |
testcase_40 | AC | 140 ms
41,588 KB |
testcase_41 | AC | 137 ms
41,516 KB |
testcase_42 | AC | 137 ms
41,676 KB |
testcase_43 | AC | 138 ms
41,504 KB |
testcase_44 | AC | 139 ms
41,448 KB |
testcase_45 | AC | 137 ms
41,496 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 | 131 ms
40,916 KB |
testcase_61 | AC | 132 ms
41,112 KB |
testcase_62 | RE | - |
testcase_63 | RE | - |
testcase_64 | AC | 133 ms
41,324 KB |
testcase_65 | RE | - |
testcase_66 | AC | 133 ms
41,280 KB |
testcase_67 | RE | - |
testcase_68 | AC | 131 ms
41,228 KB |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | AC | 132 ms
41,424 KB |
testcase_72 | AC | 132 ms
41,280 KB |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | AC | 132 ms
41,464 KB |
testcase_76 | AC | 133 ms
41,412 KB |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | AC | 120 ms
40,352 KB |
testcase_81 | RE | - |
testcase_82 | AC | 133 ms
41,460 KB |
testcase_83 | AC | 135 ms
41,600 KB |
testcase_84 | AC | 134 ms
41,464 KB |
testcase_85 | AC | 139 ms
41,264 KB |
testcase_86 | AC | 134 ms
41,088 KB |
testcase_87 | AC | 123 ms
40,136 KB |
testcase_88 | AC | 132 ms
41,212 KB |
testcase_89 | AC | 133 ms
41,476 KB |
testcase_90 | AC | 135 ms
41,356 KB |
testcase_91 | AC | 136 ms
41,468 KB |
testcase_92 | AC | 132 ms
41,068 KB |
testcase_93 | AC | 131 ms
41,088 KB |
testcase_94 | AC | 136 ms
41,540 KB |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | AC | 137 ms
41,412 KB |
testcase_98 | AC | 137 ms
41,560 KB |
testcase_99 | RE | - |
testcase_100 | AC | 133 ms
41,336 KB |
testcase_101 | AC | 137 ms
41,640 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 | 137 ms
41,276 KB |
testcase_123 | AC | 124 ms
40,348 KB |
testcase_124 | WA | - |
ソースコード
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); } } }