結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー | C_nena_E |
提出日時 | 2020-01-18 09:55:48 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,904 bytes |
コンパイル時間 | 2,101 ms |
コンパイル使用メモリ | 77,656 KB |
実行使用メモリ | 42,096 KB |
最終ジャッジ日時 | 2024-06-27 01:58:25 |
合計ジャッジ時間 | 21,675 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
41,756 KB |
testcase_01 | AC | 139 ms
41,256 KB |
testcase_02 | AC | 133 ms
42,096 KB |
testcase_03 | AC | 132 ms
41,340 KB |
testcase_04 | AC | 137 ms
41,720 KB |
testcase_05 | AC | 137 ms
41,628 KB |
testcase_06 | AC | 135 ms
41,772 KB |
testcase_07 | AC | 135 ms
41,740 KB |
testcase_08 | AC | 124 ms
40,748 KB |
testcase_09 | AC | 145 ms
41,568 KB |
testcase_10 | AC | 135 ms
41,680 KB |
testcase_11 | AC | 139 ms
41,704 KB |
testcase_12 | AC | 137 ms
41,872 KB |
testcase_13 | AC | 117 ms
40,384 KB |
testcase_14 | AC | 137 ms
41,440 KB |
testcase_15 | AC | 136 ms
41,612 KB |
testcase_16 | AC | 132 ms
41,484 KB |
testcase_17 | AC | 135 ms
41,504 KB |
testcase_18 | AC | 133 ms
41,268 KB |
testcase_19 | AC | 133 ms
41,764 KB |
testcase_20 | AC | 134 ms
41,648 KB |
testcase_21 | AC | 140 ms
41,432 KB |
testcase_22 | AC | 123 ms
40,532 KB |
testcase_23 | AC | 122 ms
40,860 KB |
testcase_24 | AC | 122 ms
40,540 KB |
testcase_25 | AC | 134 ms
41,436 KB |
testcase_26 | AC | 122 ms
40,828 KB |
testcase_27 | AC | 137 ms
41,840 KB |
testcase_28 | AC | 137 ms
41,628 KB |
testcase_29 | AC | 134 ms
41,716 KB |
testcase_30 | AC | 134 ms
41,616 KB |
testcase_31 | AC | 136 ms
41,548 KB |
testcase_32 | AC | 135 ms
41,556 KB |
testcase_33 | AC | 136 ms
41,524 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
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 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | AC | 134 ms
41,284 KB |
testcase_63 | AC | 135 ms
41,704 KB |
testcase_64 | AC | 134 ms
41,392 KB |
testcase_65 | AC | 137 ms
41,660 KB |
testcase_66 | AC | 136 ms
41,684 KB |
testcase_67 | AC | 140 ms
41,996 KB |
testcase_68 | AC | 122 ms
40,724 KB |
testcase_69 | AC | 119 ms
41,044 KB |
testcase_70 | AC | 137 ms
41,568 KB |
testcase_71 | AC | 136 ms
41,448 KB |
testcase_72 | AC | 136 ms
41,968 KB |
testcase_73 | AC | 124 ms
40,800 KB |
testcase_74 | AC | 141 ms
41,584 KB |
testcase_75 | AC | 121 ms
40,528 KB |
testcase_76 | AC | 136 ms
41,872 KB |
testcase_77 | AC | 124 ms
41,216 KB |
testcase_78 | AC | 137 ms
41,520 KB |
testcase_79 | AC | 138 ms
41,724 KB |
testcase_80 | AC | 135 ms
41,384 KB |
testcase_81 | AC | 139 ms
41,464 KB |
testcase_82 | AC | 131 ms
41,232 KB |
testcase_83 | AC | 137 ms
41,796 KB |
testcase_84 | AC | 138 ms
41,704 KB |
testcase_85 | AC | 136 ms
41,876 KB |
testcase_86 | AC | 136 ms
41,388 KB |
testcase_87 | AC | 137 ms
41,900 KB |
testcase_88 | AC | 136 ms
41,464 KB |
testcase_89 | AC | 135 ms
41,436 KB |
testcase_90 | AC | 127 ms
41,364 KB |
testcase_91 | AC | 134 ms
40,984 KB |
testcase_92 | AC | 121 ms
40,844 KB |
testcase_93 | AC | 135 ms
41,568 KB |
testcase_94 | AC | 136 ms
41,616 KB |
testcase_95 | AC | 137 ms
41,256 KB |
testcase_96 | AC | 134 ms
41,596 KB |
testcase_97 | AC | 131 ms
40,720 KB |
testcase_98 | AC | 138 ms
41,972 KB |
testcase_99 | AC | 132 ms
41,296 KB |
testcase_100 | AC | 134 ms
41,564 KB |
testcase_101 | AC | 136 ms
41,844 KB |
testcase_102 | AC | 134 ms
41,532 KB |
testcase_103 | AC | 136 ms
41,872 KB |
testcase_104 | AC | 136 ms
41,308 KB |
testcase_105 | AC | 130 ms
41,264 KB |
testcase_106 | AC | 121 ms
41,064 KB |
testcase_107 | AC | 125 ms
40,900 KB |
testcase_108 | AC | 139 ms
41,640 KB |
testcase_109 | AC | 123 ms
41,072 KB |
testcase_110 | AC | 137 ms
41,836 KB |
testcase_111 | AC | 137 ms
41,572 KB |
testcase_112 | AC | 136 ms
41,876 KB |
testcase_113 | AC | 139 ms
41,656 KB |
testcase_114 | AC | 137 ms
41,336 KB |
testcase_115 | AC | 133 ms
41,924 KB |
testcase_116 | AC | 134 ms
42,084 KB |
testcase_117 | AC | 131 ms
41,592 KB |
testcase_118 | AC | 134 ms
41,528 KB |
testcase_119 | AC | 134 ms
41,432 KB |
testcase_120 | AC | 136 ms
41,496 KB |
testcase_121 | AC | 136 ms
41,428 KB |
testcase_122 | WA | - |
testcase_123 | WA | - |
testcase_124 | WA | - |
ソースコード
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); if(a == 0 && b == 0 && c == 0){ System.out.println(-1); return; }else if(a == 0 && b == 0){ System.out.println(0); return; }else if((a == 0 && c == 0) || (b == 0 && c == 0)){ System.out.println(1); System.out.println(0); return; }else if(a == 0){ System.out.println(1); System.out.println(-c/b); return; }else if(b == 0){ if(c > 0){ System.out.println(0); }else{ System.out.println(2); double ans = Math.pow(-c,0.5); System.out.println(-ans); System.out.println(ans); } return; }else if(c == 0){ System.out.println(2); if(b < 0){ System.out.println(0); System.out.println(-b); }else{ System.out.println(-b); System.out.println(0); } return; } double chk = b*b - (4*a*c); if(chk < 0){ System.out.println(0); }else if(chk == 0){ System.out.println(1); System.out.println(-b/(2*a)); }else{ System.out.println(2); double[] ans = new double[2]; ans[0] = (-b-Math.pow(chk,0.5))/(2*a); ans[1] = (-b+Math.pow(chk,0.5))/(2*a); Arrays.sort(ans); for(int i = 0; i < 2; i++){ System.out.println(ans[i]); } } } }