結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2016-09-10 18:15:45
言語 F#
(F# 4.0)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 10,526 ms
コンパイル使用メモリ 200,284 KB
実行使用メモリ 63,212 KB
最終ジャッジ日時 2024-04-19 13:08:25
合計ジャッジ時間 16,140 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
63,076 KB
testcase_01 AC 214 ms
62,944 KB
testcase_02 AC 218 ms
62,824 KB
testcase_03 AC 216 ms
62,884 KB
testcase_04 AC 217 ms
62,816 KB
testcase_05 AC 210 ms
63,080 KB
testcase_06 AC 210 ms
62,824 KB
testcase_07 AC 217 ms
63,204 KB
testcase_08 AC 216 ms
62,952 KB
testcase_09 AC 125 ms
62,940 KB
testcase_10 AC 126 ms
63,212 KB
testcase_11 AC 128 ms
63,076 KB
testcase_12 AC 128 ms
63,200 KB
testcase_13 AC 134 ms
62,956 KB
testcase_14 AC 135 ms
62,808 KB
testcase_15 AC 136 ms
62,948 KB
testcase_16 AC 128 ms
63,208 KB
testcase_17 AC 135 ms
62,948 KB
testcase_18 AC 124 ms
63,080 KB
testcase_19 AC 123 ms
62,948 KB
testcase_20 AC 124 ms
63,076 KB
testcase_21 AC 125 ms
63,200 KB
testcase_22 AC 179 ms
62,944 KB
testcase_23 AC 147 ms
62,956 KB
testcase_24 AC 166 ms
62,940 KB
testcase_25 AC 166 ms
62,784 KB
testcase_26 AC 161 ms
62,944 KB
testcase_27 AC 161 ms
62,812 KB
testcase_28 AC 165 ms
63,076 KB
testcase_29 AC 137 ms
62,828 KB
testcase_30 AC 204 ms
63,072 KB
testcase_31 AC 136 ms
63,080 KB
testcase_32 AC 128 ms
63,072 KB
testcase_33 AC 137 ms
63,080 KB
testcase_34 AC 126 ms
63,072 KB
testcase_35 AC 128 ms
63,080 KB
testcase_36 AC 132 ms
63,080 KB
testcase_37 AC 136 ms
63,080 KB
testcase_38 AC 140 ms
63,080 KB
testcase_39 AC 128 ms
63,076 KB
testcase_40 AC 134 ms
63,072 KB
testcase_41 AC 138 ms
63,076 KB
testcase_42 AC 138 ms
62,952 KB
testcase_43 AC 134 ms
63,076 KB
testcase_44 AC 132 ms
62,940 KB
testcase_45 AC 133 ms
62,944 KB
testcase_46 AC 135 ms
62,952 KB
testcase_47 AC 126 ms
63,076 KB
testcase_48 AC 131 ms
63,196 KB
testcase_49 AC 132 ms
63,084 KB
testcase_50 AC 127 ms
62,944 KB
testcase_51 AC 124 ms
62,916 KB
testcase_52 AC 140 ms
62,952 KB
testcase_53 AC 143 ms
63,080 KB
testcase_54 AC 129 ms
63,076 KB
testcase_55 AC 132 ms
62,948 KB
testcase_56 AC 137 ms
62,940 KB
testcase_57 AC 134 ms
62,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (300 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(5,13): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System
type Sol() =

    member this.Solve() = 
        let [|A; B; C|] = stdin.ReadLine().Split(' ') |> Array.map int64
        let f x = x*x*x + A*x*x + B*x + C
        let g t =
            if (f t) = 0L then Some t
            elif (f -t) = 0L then Some -t
            else None
        
        let alpha = Seq.map g [0L..1000000L] |> Seq.find Option.isSome |> Option.get
        
        let A2 = A + alpha
        let B2 = B + alpha*A2
        let D = A2*A2 - 4L*B2
        let sqrtD:int64 = (double D) |> sqrt |> int64
        
        [alpha; (-A2 + sqrtD)/2L; (-A2 - sqrtD)/2L ] 
        |> Seq.sort |> Seq.map string |> Seq.reduce (fun s t -> s + " " + t)
        |> printfn "%s"


let mySol = new Sol()
mySol.Solve()
0