結果

問題 No.638 Sum of "not power of 2"
コンテスト
ユーザー tak
提出日時 2018-04-23 16:24:47
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 216 ms / 1,000 ms
コード長 532 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11,284 ms
コンパイル使用メモリ 208,852 KB
実行使用メモリ 37,564 KB
最終ジャッジ日時 2026-03-15 12:46:10
合計ジャッジ時間 7,834 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (198 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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"                     
0