結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー | lloyz |
提出日時 | 2023-10-25 00:15:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 933 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 82,592 KB |
実行使用メモリ | 63,008 KB |
最終ジャッジ日時 | 2024-09-24 19:18:33 |
合計ジャッジ時間 | 8,734 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
61,380 KB |
testcase_01 | AC | 38 ms
52,196 KB |
testcase_02 | AC | 39 ms
52,128 KB |
testcase_03 | AC | 37 ms
52,644 KB |
testcase_04 | AC | 38 ms
52,476 KB |
testcase_05 | AC | 38 ms
52,528 KB |
testcase_06 | AC | 38 ms
53,764 KB |
testcase_07 | AC | 37 ms
53,408 KB |
testcase_08 | AC | 38 ms
52,400 KB |
testcase_09 | AC | 38 ms
52,444 KB |
testcase_10 | AC | 38 ms
52,936 KB |
testcase_11 | AC | 38 ms
53,416 KB |
testcase_12 | AC | 37 ms
53,224 KB |
testcase_13 | AC | 37 ms
52,500 KB |
testcase_14 | AC | 37 ms
53,224 KB |
testcase_15 | AC | 39 ms
53,960 KB |
testcase_16 | AC | 38 ms
52,132 KB |
testcase_17 | AC | 37 ms
52,288 KB |
testcase_18 | AC | 37 ms
53,444 KB |
testcase_19 | AC | 37 ms
52,532 KB |
testcase_20 | AC | 37 ms
53,120 KB |
testcase_21 | AC | 37 ms
52,748 KB |
testcase_22 | AC | 38 ms
52,596 KB |
testcase_23 | AC | 37 ms
53,140 KB |
testcase_24 | AC | 37 ms
53,016 KB |
testcase_25 | AC | 38 ms
52,464 KB |
testcase_26 | AC | 37 ms
52,832 KB |
testcase_27 | AC | 39 ms
52,788 KB |
testcase_28 | AC | 36 ms
53,368 KB |
testcase_29 | AC | 38 ms
52,336 KB |
testcase_30 | AC | 37 ms
53,220 KB |
testcase_31 | AC | 39 ms
52,532 KB |
testcase_32 | AC | 38 ms
53,264 KB |
testcase_33 | AC | 37 ms
53,488 KB |
testcase_34 | AC | 46 ms
61,800 KB |
testcase_35 | AC | 46 ms
61,212 KB |
testcase_36 | AC | 46 ms
61,412 KB |
testcase_37 | AC | 48 ms
61,876 KB |
testcase_38 | AC | 46 ms
62,336 KB |
testcase_39 | AC | 46 ms
60,748 KB |
testcase_40 | AC | 47 ms
62,632 KB |
testcase_41 | AC | 45 ms
62,628 KB |
testcase_42 | AC | 45 ms
62,296 KB |
testcase_43 | AC | 46 ms
61,384 KB |
testcase_44 | AC | 46 ms
61,604 KB |
testcase_45 | AC | 46 ms
62,804 KB |
testcase_46 | AC | 46 ms
61,904 KB |
testcase_47 | AC | 46 ms
61,080 KB |
testcase_48 | AC | 47 ms
60,996 KB |
testcase_49 | AC | 46 ms
61,868 KB |
testcase_50 | AC | 45 ms
62,284 KB |
testcase_51 | AC | 47 ms
61,892 KB |
testcase_52 | AC | 46 ms
60,996 KB |
testcase_53 | AC | 47 ms
61,540 KB |
testcase_54 | AC | 47 ms
62,208 KB |
testcase_55 | AC | 45 ms
61,928 KB |
testcase_56 | AC | 46 ms
62,740 KB |
testcase_57 | AC | 46 ms
62,540 KB |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | AC | 37 ms
53,232 KB |
testcase_61 | AC | 39 ms
53,376 KB |
testcase_62 | AC | 46 ms
62,600 KB |
testcase_63 | AC | 48 ms
61,484 KB |
testcase_64 | AC | 39 ms
52,196 KB |
testcase_65 | AC | 47 ms
62,232 KB |
testcase_66 | AC | 39 ms
52,904 KB |
testcase_67 | AC | 46 ms
60,948 KB |
testcase_68 | AC | 38 ms
54,060 KB |
testcase_69 | AC | 46 ms
61,056 KB |
testcase_70 | AC | 46 ms
62,528 KB |
testcase_71 | AC | 38 ms
53,444 KB |
testcase_72 | AC | 37 ms
52,476 KB |
testcase_73 | AC | 46 ms
61,736 KB |
testcase_74 | AC | 46 ms
61,152 KB |
testcase_75 | AC | 37 ms
51,880 KB |
testcase_76 | AC | 38 ms
52,576 KB |
testcase_77 | AC | 46 ms
61,668 KB |
testcase_78 | AC | 47 ms
61,892 KB |
testcase_79 | AC | 47 ms
61,148 KB |
testcase_80 | AC | 37 ms
52,804 KB |
testcase_81 | AC | 46 ms
61,484 KB |
testcase_82 | AC | 38 ms
52,860 KB |
testcase_83 | AC | 38 ms
53,416 KB |
testcase_84 | AC | 37 ms
53,012 KB |
testcase_85 | AC | 38 ms
53,936 KB |
testcase_86 | AC | 37 ms
52,688 KB |
testcase_87 | AC | 37 ms
53,532 KB |
testcase_88 | AC | 37 ms
53,484 KB |
testcase_89 | AC | 37 ms
52,932 KB |
testcase_90 | AC | 37 ms
53,588 KB |
testcase_91 | AC | 39 ms
52,656 KB |
testcase_92 | AC | 38 ms
53,120 KB |
testcase_93 | AC | 38 ms
52,788 KB |
testcase_94 | AC | 37 ms
52,500 KB |
testcase_95 | AC | 38 ms
52,560 KB |
testcase_96 | AC | 38 ms
52,192 KB |
testcase_97 | AC | 37 ms
52,996 KB |
testcase_98 | AC | 38 ms
52,596 KB |
testcase_99 | AC | 38 ms
53,568 KB |
testcase_100 | AC | 37 ms
52,404 KB |
testcase_101 | AC | 37 ms
53,664 KB |
testcase_102 | AC | 37 ms
52,928 KB |
testcase_103 | AC | 38 ms
52,484 KB |
testcase_104 | AC | 37 ms
52,136 KB |
testcase_105 | AC | 37 ms
53,264 KB |
testcase_106 | AC | 38 ms
52,880 KB |
testcase_107 | AC | 38 ms
52,864 KB |
testcase_108 | AC | 39 ms
53,732 KB |
testcase_109 | AC | 37 ms
53,696 KB |
testcase_110 | AC | 37 ms
52,864 KB |
testcase_111 | AC | 38 ms
52,344 KB |
testcase_112 | AC | 37 ms
52,812 KB |
testcase_113 | AC | 37 ms
52,740 KB |
testcase_114 | AC | 38 ms
52,952 KB |
testcase_115 | AC | 38 ms
53,032 KB |
testcase_116 | AC | 38 ms
53,308 KB |
testcase_117 | AC | 37 ms
53,492 KB |
testcase_118 | AC | 37 ms
52,700 KB |
testcase_119 | AC | 37 ms
53,160 KB |
testcase_120 | AC | 38 ms
52,608 KB |
testcase_121 | AC | 37 ms
53,268 KB |
testcase_122 | AC | 45 ms
62,044 KB |
testcase_123 | AC | 47 ms
61,792 KB |
testcase_124 | AC | 53 ms
62,544 KB |
ソースコード
def calc(a, b, c, x): return a * x**2 + b * x + c a, b, c = map(int, input().split()) if a == b == 0: if c == 0: print(-1) else: print(0) elif a == 0: print(1) print(-c / b) else: d = b**2 - 4 * a * c if d < 0: print(0) elif d == 0: print(1) print(-b / 2 / a) else: print(2) if a < 0: a *= -1 b *= -1 c *= -1 ng, ok = -10**10, -b / 2 / a for _ in range(10000): mid = (ng + ok) / 2 res = calc(a, b, c, mid) if res <= 0: ok = mid else: ng = mid print(ok) ok, ng = -b / 2 / a, 10**10 for _ in range(10000): mid = (ng + ok) / 2 res = calc(a, b, c, mid) if res <= 0: ok = mid else: ng = mid print(ok)