結果

問題 No.638 Sum of "not power of 2"
ユーザー taktak
提出日時 2018-04-23 16:23:13
言語 F#
(.NET 7)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 4,277 ms
コンパイル使用メモリ 156,992 KB
実行使用メモリ 25,220 KB
最終ジャッジ日時 2023-09-09 21:36:23
合計ジャッジ時間 6,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
25,004 KB
testcase_01 AC 88 ms
22,944 KB
testcase_02 AC 87 ms
22,960 KB
testcase_03 AC 90 ms
23,064 KB
testcase_04 AC 95 ms
23,212 KB
testcase_05 AC 90 ms
22,956 KB
testcase_06 AC 96 ms
25,220 KB
testcase_07 AC 94 ms
23,208 KB
testcase_08 AC 95 ms
21,164 KB
testcase_09 WA -
testcase_10 AC 94 ms
23,152 KB
testcase_11 AC 95 ms
25,136 KB
testcase_12 AC 88 ms
23,104 KB
testcase_13 AC 94 ms
25,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let isEnable N =
    let powOf2Set =
        let powOf2Seq = Seq.unfold (fun x -> if x>100000000L 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