Language Test

Submission #1287737

Source codeソースコード

open Num

let solve a b c =
  if a =/ (num_of_int 0) then
    if b =/ (num_of_int 0) then
      if c =/ (num_of_int 0) then
        Printf.printf "3\n"
      else
        Printf.printf "0\n"
    else
      let r =  (-1.0) *. (float_of_num c) /. (float_of_num b) in
      Printf.printf "1 %f\n" r
  else
    let d = b */ b -/ (num_of_int 4) */ a */ c in
    if d </ (num_of_int 0) then
      Printf.printf "0\n"
    else
      if d =/ (num_of_int 0) then
        let r = (-1.0) *. (float_of_num b) /. (2.0 *. (float_of_num a)) in
        Printf.printf "1 %f\n" r
      else
        let r1 = ((-1.0) *. (float_of_num b) -. sqrt (float_of_num d)) /. (2.0 *. (float_of_num a)) in
        let r2 = ((-1.0) *. (float_of_num b) +. sqrt (float_of_num d)) /. (2.0 *. (float_of_num 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 "%s %s %s\n" (fun x y z -> (num_of_string x, num_of_string y, num_of_string 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ソースコード長 1147 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