結果

問題 No.955 ax^2+bx+c=0
ユーザー しぶつまひしぶつまひ
提出日時 2019-12-18 08:01:33
言語 F#
(F# 4.0)
結果
AC  
実行時間 377 ms / 2,000 ms
コード長 1,388 bytes
コンパイル時間 14,437 ms
コンパイル使用メモリ 191,248 KB
実行使用メモリ 37,664 KB
最終ジャッジ日時 2024-09-18 22:09:50
合計ジャッジ時間 56,407 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 371 ms
36,604 KB
testcase_01 AC 366 ms
36,296 KB
testcase_02 AC 79 ms
32,248 KB
testcase_03 AC 73 ms
30,848 KB
testcase_04 AC 71 ms
30,720 KB
testcase_05 AC 71 ms
30,720 KB
testcase_06 AC 71 ms
30,960 KB
testcase_07 AC 76 ms
30,848 KB
testcase_08 AC 73 ms
30,976 KB
testcase_09 AC 70 ms
30,848 KB
testcase_10 AC 76 ms
30,848 KB
testcase_11 AC 74 ms
31,072 KB
testcase_12 AC 74 ms
30,976 KB
testcase_13 AC 70 ms
30,720 KB
testcase_14 AC 352 ms
34,984 KB
testcase_15 AC 354 ms
35,060 KB
testcase_16 AC 359 ms
35,036 KB
testcase_17 AC 357 ms
36,076 KB
testcase_18 AC 352 ms
35,824 KB
testcase_19 AC 358 ms
35,892 KB
testcase_20 AC 362 ms
35,064 KB
testcase_21 AC 357 ms
35,256 KB
testcase_22 AC 364 ms
35,248 KB
testcase_23 AC 360 ms
35,852 KB
testcase_24 AC 358 ms
35,916 KB
testcase_25 AC 366 ms
35,204 KB
testcase_26 AC 361 ms
35,960 KB
testcase_27 AC 359 ms
35,912 KB
testcase_28 AC 354 ms
35,136 KB
testcase_29 AC 355 ms
35,972 KB
testcase_30 AC 357 ms
34,884 KB
testcase_31 AC 363 ms
35,216 KB
testcase_32 AC 356 ms
35,972 KB
testcase_33 AC 361 ms
35,916 KB
testcase_34 AC 372 ms
37,280 KB
testcase_35 AC 372 ms
37,420 KB
testcase_36 AC 376 ms
37,384 KB
testcase_37 AC 374 ms
37,404 KB
testcase_38 AC 377 ms
37,160 KB
testcase_39 AC 376 ms
37,412 KB
testcase_40 AC 371 ms
37,396 KB
testcase_41 AC 366 ms
37,284 KB
testcase_42 AC 367 ms
37,164 KB
testcase_43 AC 371 ms
37,416 KB
testcase_44 AC 368 ms
37,280 KB
testcase_45 AC 376 ms
37,664 KB
testcase_46 AC 369 ms
37,156 KB
testcase_47 AC 375 ms
37,540 KB
testcase_48 AC 376 ms
37,404 KB
testcase_49 AC 375 ms
37,420 KB
testcase_50 AC 375 ms
37,416 KB
testcase_51 AC 377 ms
37,280 KB
testcase_52 AC 377 ms
37,524 KB
testcase_53 AC 372 ms
37,412 KB
testcase_54 AC 371 ms
37,420 KB
testcase_55 AC 371 ms
37,288 KB
testcase_56 AC 371 ms
37,420 KB
testcase_57 AC 375 ms
37,412 KB
testcase_58 AC 372 ms
37,312 KB
testcase_59 AC 374 ms
37,380 KB
testcase_60 AC 85 ms
32,512 KB
testcase_61 AC 91 ms
32,640 KB
testcase_62 AC 377 ms
37,612 KB
testcase_63 AC 375 ms
37,408 KB
testcase_64 AC 78 ms
32,512 KB
testcase_65 AC 371 ms
37,364 KB
testcase_66 AC 87 ms
32,592 KB
testcase_67 AC 369 ms
37,288 KB
testcase_68 AC 82 ms
32,384 KB
testcase_69 AC 374 ms
37,540 KB
testcase_70 AC 370 ms
37,284 KB
testcase_71 AC 82 ms
32,640 KB
testcase_72 AC 80 ms
32,508 KB
testcase_73 AC 373 ms
37,420 KB
testcase_74 AC 373 ms
36,788 KB
testcase_75 AC 83 ms
32,384 KB
testcase_76 AC 82 ms
32,512 KB
testcase_77 AC 370 ms
37,344 KB
testcase_78 AC 372 ms
37,156 KB
testcase_79 AC 367 ms
37,136 KB
testcase_80 AC 84 ms
32,628 KB
testcase_81 AC 374 ms
37,656 KB
testcase_82 AC 358 ms
34,880 KB
testcase_83 AC 367 ms
37,200 KB
testcase_84 AC 363 ms
37,060 KB
testcase_85 AC 366 ms
36,940 KB
testcase_86 AC 366 ms
37,068 KB
testcase_87 AC 357 ms
36,048 KB
testcase_88 AC 360 ms
35,132 KB
testcase_89 AC 354 ms
35,136 KB
testcase_90 AC 363 ms
37,184 KB
testcase_91 AC 363 ms
37,056 KB
testcase_92 AC 72 ms
31,088 KB
testcase_93 AC 70 ms
30,848 KB
testcase_94 AC 363 ms
36,796 KB
testcase_95 AC 364 ms
36,812 KB
testcase_96 AC 360 ms
36,920 KB
testcase_97 AC 362 ms
36,804 KB
testcase_98 AC 367 ms
36,916 KB
testcase_99 AC 368 ms
36,932 KB
testcase_100 AC 71 ms
30,848 KB
testcase_101 AC 367 ms
37,028 KB
testcase_102 AC 360 ms
35,008 KB
testcase_103 AC 358 ms
35,248 KB
testcase_104 AC 361 ms
35,132 KB
testcase_105 AC 360 ms
34,944 KB
testcase_106 AC 364 ms
35,224 KB
testcase_107 AC 357 ms
35,292 KB
testcase_108 AC 356 ms
35,328 KB
testcase_109 AC 359 ms
35,952 KB
testcase_110 AC 354 ms
36,148 KB
testcase_111 AC 360 ms
35,068 KB
testcase_112 AC 357 ms
35,168 KB
testcase_113 AC 361 ms
35,824 KB
testcase_114 AC 359 ms
35,284 KB
testcase_115 AC 362 ms
35,168 KB
testcase_116 AC 360 ms
35,248 KB
testcase_117 AC 359 ms
35,948 KB
testcase_118 AC 359 ms
35,248 KB
testcase_119 AC 360 ms
36,056 KB
testcase_120 AC 357 ms
35,368 KB
testcase_121 AC 356 ms
35,168 KB
testcase_122 AC 368 ms
37,164 KB
testcase_123 AC 360 ms
35,524 KB
testcase_124 AC 362 ms
35,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (291 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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|] -> pr [bigint 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]
| _ -> ()
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0