結果

問題 No.955 ax^2+bx+c=0
ユーザー しぶつまひしぶつまひ
提出日時 2019-12-18 07:59:16
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 1,386 bytes
コンパイル時間 4,163 ms
コンパイル使用メモリ 156,928 KB
実行使用メモリ 26,752 KB
最終ジャッジ日時 2023-09-21 06:07:34
合計ジャッジ時間 19,395 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
23,660 KB
testcase_01 AC 104 ms
25,584 KB
testcase_02 AC 79 ms
24,748 KB
testcase_03 AC 72 ms
24,640 KB
testcase_04 AC 72 ms
22,484 KB
testcase_05 AC 71 ms
22,424 KB
testcase_06 AC 71 ms
22,492 KB
testcase_07 AC 71 ms
22,704 KB
testcase_08 AC 71 ms
24,480 KB
testcase_09 AC 71 ms
24,644 KB
testcase_10 AC 71 ms
22,604 KB
testcase_11 AC 73 ms
22,484 KB
testcase_12 AC 71 ms
22,640 KB
testcase_13 AC 71 ms
22,640 KB
testcase_14 AC 100 ms
25,628 KB
testcase_15 AC 99 ms
25,496 KB
testcase_16 AC 98 ms
23,572 KB
testcase_17 AC 99 ms
23,608 KB
testcase_18 AC 100 ms
23,592 KB
testcase_19 AC 101 ms
23,604 KB
testcase_20 AC 100 ms
23,608 KB
testcase_21 AC 104 ms
23,628 KB
testcase_22 AC 101 ms
23,604 KB
testcase_23 AC 99 ms
23,576 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 110 ms
25,644 KB
testcase_35 AC 110 ms
25,472 KB
testcase_36 AC 110 ms
21,496 KB
testcase_37 AC 113 ms
23,492 KB
testcase_38 AC 110 ms
23,608 KB
testcase_39 AC 111 ms
23,496 KB
testcase_40 AC 110 ms
25,544 KB
testcase_41 AC 110 ms
25,600 KB
testcase_42 AC 109 ms
23,636 KB
testcase_43 AC 110 ms
23,636 KB
testcase_44 AC 111 ms
23,480 KB
testcase_45 AC 112 ms
23,568 KB
testcase_46 AC 110 ms
21,560 KB
testcase_47 AC 112 ms
23,484 KB
testcase_48 AC 110 ms
25,624 KB
testcase_49 AC 109 ms
23,540 KB
testcase_50 AC 111 ms
25,636 KB
testcase_51 AC 110 ms
23,520 KB
testcase_52 AC 110 ms
23,572 KB
testcase_53 AC 110 ms
23,436 KB
testcase_54 AC 110 ms
25,644 KB
testcase_55 AC 109 ms
23,600 KB
testcase_56 AC 107 ms
23,512 KB
testcase_57 AC 110 ms
23,616 KB
testcase_58 AC 109 ms
25,688 KB
testcase_59 AC 109 ms
23,600 KB
testcase_60 AC 79 ms
24,712 KB
testcase_61 AC 81 ms
22,780 KB
testcase_62 AC 111 ms
23,596 KB
testcase_63 AC 112 ms
23,584 KB
testcase_64 AC 81 ms
24,832 KB
testcase_65 AC 112 ms
25,540 KB
testcase_66 AC 80 ms
22,812 KB
testcase_67 AC 111 ms
25,592 KB
testcase_68 AC 80 ms
22,836 KB
testcase_69 AC 109 ms
23,576 KB
testcase_70 AC 112 ms
25,612 KB
testcase_71 AC 81 ms
22,952 KB
testcase_72 AC 80 ms
22,828 KB
testcase_73 AC 111 ms
23,484 KB
testcase_74 AC 111 ms
25,696 KB
testcase_75 AC 81 ms
24,760 KB
testcase_76 AC 81 ms
22,912 KB
testcase_77 AC 111 ms
23,576 KB
testcase_78 AC 111 ms
23,644 KB
testcase_79 AC 112 ms
25,616 KB
testcase_80 AC 79 ms
22,880 KB
testcase_81 AC 111 ms
23,540 KB
testcase_82 WA -
testcase_83 AC 102 ms
23,436 KB
testcase_84 AC 103 ms
25,492 KB
testcase_85 AC 103 ms
23,348 KB
testcase_86 AC 102 ms
21,504 KB
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 AC 103 ms
23,404 KB
testcase_91 AC 103 ms
23,560 KB
testcase_92 AC 72 ms
24,504 KB
testcase_93 AC 72 ms
24,532 KB
testcase_94 AC 103 ms
23,484 KB
testcase_95 AC 105 ms
23,384 KB
testcase_96 AC 102 ms
25,544 KB
testcase_97 AC 100 ms
23,468 KB
testcase_98 AC 102 ms
23,620 KB
testcase_99 AC 103 ms
23,448 KB
testcase_100 AC 72 ms
22,592 KB
testcase_101 AC 101 ms
23,488 KB
testcase_102 AC 99 ms
23,616 KB
testcase_103 AC 100 ms
23,528 KB
testcase_104 AC 101 ms
23,620 KB
testcase_105 AC 101 ms
25,568 KB
testcase_106 AC 101 ms
23,660 KB
testcase_107 AC 99 ms
23,616 KB
testcase_108 AC 101 ms
25,576 KB
testcase_109 AC 99 ms
23,440 KB
testcase_110 AC 101 ms
23,680 KB
testcase_111 AC 102 ms
23,576 KB
testcase_112 AC 100 ms
23,672 KB
testcase_113 AC 100 ms
23,520 KB
testcase_114 AC 101 ms
23,608 KB
testcase_115 AC 101 ms
21,472 KB
testcase_116 AC 100 ms
25,652 KB
testcase_117 AC 100 ms
25,680 KB
testcase_118 AC 101 ms
23,516 KB
testcase_119 AC 102 ms
25,668 KB
testcase_120 AC 100 ms
25,568 KB
testcase_121 AC 101 ms
23,716 KB
testcase_122 AC 112 ms
25,536 KB
testcase_123 AC 106 ms
23,772 KB
testcase_124 AC 106 ms
23,684 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let e30 = bigint 1e30 
let e16 = bigint 1e16
let abc =
  stdin.ReadLine().Split(' ')
  |> Array.map int
  

let conv (x:bigint)=
    let y = string <| abs x / e30
    let z = string <| (abs x % e30) + e30
    let s = if x < bigint 0 then "-" else ""
    s + y + "." + (z.Substring(1))

let pr (xs:bigint list) =
    printfn "%d" (List.length xs)
    List.sort xs
    |> List.map conv
    |> List.iter (printfn "%s")

let sq (x:bigint) =
  let rec f e y z =
    if abs (x * e30 - e * e) < e16 * e30 then
      e
    elif e * e < x * e30 then
      f ((e+z)/bigint 2) e z
    else
      f ((y+e)/bigint 2) y e
  f (x/bigint 2) (bigint 0) x
     

match abc with
| [|0;0;0|] -> printfn "-1"
| [|0;0;_|] -> printfn "0"
| [|0;b;c|] -> pr [-bigint c * e30 / bigint b]
| [|a;0;0|] -> printfn "0"
| [|a;0;c|] when -bigint c  * e30 / bigint a < bigint  0 -> printfn "0"
| [|a;0;c|] -> let e = -bigint c * e30 / bigint a in let ee = sq e in pr [-ee; ee]
| [|a;b;0|] -> pr [bigint 0; -bigint b * e30 /bigint a]
| [|a;b;c|] ->
    let d = bigint b * bigint b - bigint 4 * bigint a * bigint c
    if d < bigint 0 then
      printfn "0"
    elif d = bigint 0 then
      pr [- bigint b * e30 / (bigint 2 * bigint a)]
    else
      let y = (-bigint b * e30 + sq (d *e30)) / (bigint 2 * bigint a)
      let z = (-bigint b * e30 - sq (d * e30)) / (bigint 2 * bigint a)
      pr [y;z]
| _ -> ()
    




0