結果
問題 |
No.638 Sum of "not power of 2"
|
ユーザー |
![]() |
提出日時 | 2018-04-23 16:24:47 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 351 ms / 1,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 8,734 ms |
コンパイル使用メモリ | 184,980 KB |
実行使用メモリ | 35,368 KB |
最終ジャッジ日時 | 2024-06-27 14:06:55 |
合計ジャッジ時間 | 10,698 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (246 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let isEnable N = let powOf2Set = let powOf2Seq = Seq.unfold (fun x -> if x>(10.0**18.0|>int64) then None else Some(x,x*2L)) 1L powOf2Seq |> Set.ofSeq let lis = [3L .. (min (N-1L) 130L)] lis |> List.tryFind(fun x -> let y = N-x not (powOf2Set.Contains x) && not (powOf2Set.Contains y)) let N = stdin.ReadLine() |> int64 N |> isEnable |> function | None -> sprintf "-1" | Some(x) -> sprintf "%i %i" x (N-x) |> printfn "%s"