結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2016-09-10 18:00:53
言語 F#
(F# 4.0)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 14,443 ms
コンパイル使用メモリ 199,232 KB
実行使用メモリ 65,212 KB
最終ジャッジ日時 2024-10-11 05:29:01
合計ジャッジ時間 26,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
63,300 KB
testcase_01 AC 227 ms
63,044 KB
testcase_02 AC 227 ms
63,048 KB
testcase_03 AC 226 ms
63,168 KB
testcase_04 AC 225 ms
63,040 KB
testcase_05 AC 229 ms
63,172 KB
testcase_06 AC 226 ms
63,168 KB
testcase_07 AC 232 ms
63,184 KB
testcase_08 AC 229 ms
63,048 KB
testcase_09 AC 150 ms
63,044 KB
testcase_10 AC 149 ms
63,172 KB
testcase_11 AC 149 ms
63,044 KB
testcase_12 AC 149 ms
63,044 KB
testcase_13 AC 153 ms
63,428 KB
testcase_14 AC 149 ms
65,212 KB
testcase_15 AC 147 ms
63,308 KB
testcase_16 AC 151 ms
63,168 KB
testcase_17 AC 148 ms
63,176 KB
testcase_18 AC 150 ms
63,168 KB
testcase_19 AC 150 ms
63,032 KB
testcase_20 AC 149 ms
62,920 KB
testcase_21 AC 151 ms
63,032 KB
testcase_22 AC 202 ms
63,044 KB
testcase_23 AC 173 ms
63,172 KB
testcase_24 AC 184 ms
63,180 KB
testcase_25 AC 185 ms
63,048 KB
testcase_26 AC 184 ms
62,912 KB
testcase_27 AC 180 ms
63,044 KB
testcase_28 AC 174 ms
63,176 KB
testcase_29 AC 158 ms
63,036 KB
testcase_30 AC 211 ms
63,052 KB
testcase_31 AC 149 ms
63,168 KB
testcase_32 AC 151 ms
63,044 KB
testcase_33 AC 148 ms
63,212 KB
testcase_34 AC 150 ms
63,048 KB
testcase_35 AC 150 ms
63,176 KB
testcase_36 AC 150 ms
63,168 KB
testcase_37 AC 151 ms
63,176 KB
testcase_38 AC 151 ms
62,924 KB
testcase_39 AC 150 ms
63,040 KB
testcase_40 AC 158 ms
63,048 KB
testcase_41 AC 157 ms
62,916 KB
testcase_42 AC 159 ms
63,168 KB
testcase_43 AC 154 ms
63,048 KB
testcase_44 AC 157 ms
63,168 KB
testcase_45 AC 153 ms
63,044 KB
testcase_46 AC 157 ms
63,172 KB
testcase_47 AC 152 ms
63,172 KB
testcase_48 AC 151 ms
63,180 KB
testcase_49 AC 150 ms
63,040 KB
testcase_50 AC 150 ms
63,168 KB
testcase_51 AC 150 ms
63,168 KB
testcase_52 AC 153 ms
63,036 KB
testcase_53 AC 153 ms
63,040 KB
testcase_54 AC 154 ms
63,044 KB
testcase_55 AC 154 ms
63,176 KB
testcase_56 AC 153 ms
63,172 KB
testcase_57 AC 154 ms
63,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (378 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