結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2016-09-10 18:00:53
言語 F#
(F# 4.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 8,974 ms
コンパイル使用メモリ 200,524 KB
実行使用メモリ 63,288 KB
最終ジャッジ日時 2024-04-19 13:06:48
合計ジャッジ時間 19,015 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
62,912 KB
testcase_01 AC 203 ms
62,928 KB
testcase_02 AC 204 ms
63,044 KB
testcase_03 AC 200 ms
62,916 KB
testcase_04 AC 199 ms
63,188 KB
testcase_05 AC 196 ms
63,044 KB
testcase_06 AC 199 ms
63,144 KB
testcase_07 AC 199 ms
63,048 KB
testcase_08 AC 206 ms
62,924 KB
testcase_09 AC 133 ms
63,044 KB
testcase_10 AC 129 ms
62,960 KB
testcase_11 AC 127 ms
63,044 KB
testcase_12 AC 128 ms
62,924 KB
testcase_13 AC 129 ms
63,052 KB
testcase_14 AC 128 ms
63,052 KB
testcase_15 AC 127 ms
62,916 KB
testcase_16 AC 130 ms
62,916 KB
testcase_17 AC 128 ms
62,924 KB
testcase_18 AC 133 ms
63,040 KB
testcase_19 AC 132 ms
62,924 KB
testcase_20 AC 135 ms
62,920 KB
testcase_21 AC 133 ms
63,160 KB
testcase_22 AC 178 ms
63,044 KB
testcase_23 AC 145 ms
63,044 KB
testcase_24 AC 158 ms
62,916 KB
testcase_25 AC 159 ms
63,016 KB
testcase_26 AC 155 ms
63,052 KB
testcase_27 AC 157 ms
63,176 KB
testcase_28 AC 155 ms
63,168 KB
testcase_29 AC 139 ms
63,016 KB
testcase_30 AC 186 ms
63,252 KB
testcase_31 AC 131 ms
63,176 KB
testcase_32 AC 134 ms
63,144 KB
testcase_33 AC 140 ms
63,176 KB
testcase_34 AC 134 ms
63,056 KB
testcase_35 AC 133 ms
62,920 KB
testcase_36 AC 133 ms
62,924 KB
testcase_37 AC 133 ms
63,176 KB
testcase_38 AC 131 ms
63,044 KB
testcase_39 AC 133 ms
63,044 KB
testcase_40 AC 138 ms
62,920 KB
testcase_41 AC 134 ms
63,160 KB
testcase_42 AC 131 ms
62,924 KB
testcase_43 AC 134 ms
62,912 KB
testcase_44 AC 140 ms
62,924 KB
testcase_45 AC 133 ms
63,156 KB
testcase_46 AC 133 ms
63,288 KB
testcase_47 AC 130 ms
63,044 KB
testcase_48 AC 135 ms
63,176 KB
testcase_49 AC 133 ms
63,048 KB
testcase_50 AC 135 ms
63,044 KB
testcase_51 AC 135 ms
63,052 KB
testcase_52 AC 134 ms
63,172 KB
testcase_53 AC 136 ms
63,044 KB
testcase_54 AC 137 ms
62,920 KB
testcase_55 AC 135 ms
63,040 KB
testcase_56 AC 138 ms
62,924 KB
testcase_57 AC 142 ms
63,040 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (292 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 x = Seq.find (fun (x:int64) -> ( x*x*x + A*x*x + B*x + C = 0L ) || ( -x*x*x + A*x*x - B*x + C = 0L )) [0L..1000000L]
        let alpha = if x*x*x + A*x*x + B*x + C = 0L then x else -x
        
        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