結果
| 問題 | No.638 Sum of "not power of 2" | 
| コンテスト | |
| ユーザー |  tak | 
| 提出日時 | 2018-04-23 16:25:48 | 
| 言語 | F# (F# 4.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 355 ms / 1,000 ms | 
| コード長 | 514 bytes | 
| コンパイル時間 | 14,739 ms | 
| コンパイル使用メモリ | 192,352 KB | 
| 実行使用メモリ | 35,268 KB | 
| 最終ジャッジ日時 | 2024-06-27 14:07:14 | 
| 合計ジャッジ時間 | 11,046 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (419 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>N 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"                     
            
            
            
        