Language Test

Submission #1287518

Source codeソースコード

let solve a b c =
  if a = 0 then
    let r = (-1.0) *. (float_of_int c) /. (float_of_int b) in
    Printf.printf "1 %f\n" r
  else
    let d = b * b - 4 * a * c in
    if d < 0 then
      Printf.printf "0\n"
    else
      if d = 0 then
        let r = (-1.0) *. (float_of_int b) /. (2.0 *. (float_of_int a)) in
        Printf.printf "1 %f\n" r
      else
        let r1 = ((-1.0) *. (float_of_int b) -. sqrt (float_of_int d)) /. (2.0 *. (float_of_int a)) in
        let r2 = ((-1.0) *. (float_of_int b) +. sqrt (float_of_int d)) /. (2.0 *. (float_of_int a)) in
        Printf.printf "2 %f %f\n" (min r1 r2) (max r1 r2)
      
let () =
  let t = Scanf.scanf "%d\n" (fun x -> x) in
  let rec loop n =
    if n = 0 then ()
    else
      let a, b, c = Scanf.scanf "%d %d %d\n" (fun x y z -> (x, y, z)) in
      solve a b c;
      loop (n-1)
  in
  loop t

Submission

Task問題 H - 一変数方程式
User nameユーザ名 ducktail
Created time投稿日時
Language言語 OCaml (4.02.3)
Status状態 WA
Score得点 0
Source lengthソースコード長 881 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 input_01.txt,input_02.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
input_01.txt WA
input_02.txt AC 1 ms 384 KB